Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set a custom header with Outlook/Office 365 REST

I know it is possible to get the headers from an email with this Outlook REST, but is there a way that we can set custom headers as well? I can't seem to find any documentation.

like image 923
Corey Larson Avatar asked Jul 05 '16 23:07

Corey Larson


People also ask

Can you add a header to an Outlook email?

Click "Settings" > "Appearance" on the left menu. Scroll down to "Email Headers and Footers." Click the "HTML Header" dropdown and select either HTML Header or Text header. Enter the header and footer information into the appropriate box.


1 Answers

Try setting the SingleValueExtendedProperties on the message object. You can try using the property id for PS_INTERNET_HEADERS - {00020386-0000-0000-C000-000000000046}.

Creating a new message with a custom header might look something like this:

POST https://outlook.office.com/api/beta/me/messages

Content-Type: application/json
{
    ...,
    "SingleValueExtendedProperties": [
        {
            "PropertyId":"String {00020386-0000-0000-C000-000000000046} Name x-my-custom-header",
            "Value":"Some Value"
        }
    ]
}
like image 132
Joy Peterson Avatar answered Oct 08 '22 11:10

Joy Peterson