question

PedroTorres-0672 avatar image
0 Votes"
PedroTorres-0672 asked MdeRooij answered

UpdateItem to add new InternetHeaders that are available along with X-headers

I am trying to add an additional Header to an email using an Outlook addin (copying an email and sending that copy to a server to process the mail based on the received Headers), but if I include it in the UpdateItem request, as an ExtendedProperty, the received email has this as an extended property but not as a regular InternetHeader, like the X-headers. How could I add this Custom_Header to the mail?

I tried Appending the header directly in the InterMessageHeaders property, but that doesnt work as that function is only available for certain other fields.

 '<?xml version="1.0" encoding="utf-8"?>' +
             "<soap:Envelope" +
             '  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
             '  xmlns:xsd="http://www.w3.org/2001/XMLSchema"' +
             '  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"' +
             '  xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"> ' +
             "  <soap:Header>" +
             '  <t:RequestServerVersion Version="Exchange2013" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" soap:mustUnderstand="0"/>' +
             "  </soap:Header>" +
             "  <soap:Body>" +
             '    <UpdateItem MessageDisposition="SaveOnly" ConflictResolution="AutoResolve"' +
             '                xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">' +
             "      <ItemChanges>" +
             "      <t:ItemChange>" +
             '        <t:ItemId Id="' +
             itemId +
             '" ChangeKey="' +
             changeKey +
             '"/>' +
             "        <t:Updates>" +
             "          <t:SetItemField>" +
             '            <t:ExtendedFieldURI DistinguishedPropertySetId="InternetHeaders" PropertyName="Custom_Header" PropertyType="Integer"/>' +
             "            <t:Message>" +
             "              <t:ExtendedProperty>" +
             '                <t:ExtendedFieldURI DistinguishedPropertySetId="InternetHeaders" PropertyName="Custom_Header" PropertyType="Integer"/>' +
             "                <t:Value>42</t:Value>" +
             "              </t:ExtendedProperty>" +
             "            </t:Message>" +
             "          </t:SetItemField>" +
             "        </t:Updates>" +
             "        </t:ItemChange>" +
             "      </ItemChanges>" +
             "    </UpdateItem>" +
             "  </soap:Body>" +
             "</soap:Envelope>";
office-exchange-server-mailflowoffice-addins-devoffice-exchange-server-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MdeRooij avatar image
0 Votes"
MdeRooij answered

InternetMessageHeaders collection will only return some of the headers and is read-only; to retrieve the entire thing, get the MAPI property PR_TRANSPORT_MESSAGE_HEADERS (0x007D).
Here's an (old) article that might get you going: link


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.