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
UpdateItem to add new InternetHeaders that are available along with X-headers
Pedro Torres
1
Reputation point
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>";
1 answer
Sort by: Most helpful
-
Michel de Rooij 1,536 Reputation points MVP
2022-03-08T13:13:33.963+00:00