I can't save an EWS email message in Office 365 outlook.
Hello. I try to add an email message by using Microsoft.Exchange.WebServices lib in C#. I create a new 'Microsoft.Exchange.WebServices.Data.EmailMessage', which looks like this:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope>
<soap:Header>
<t:RequestServerVersion Version="Exchange2007_SP1" />
<t:TimeZoneContext>
<t:TimeZoneDefinition Id="UTC" />
</t:TimeZoneContext>
<t:ExchangeImpersonation>
<t:ConnectingSID>
<t:PrimarySmtpAddress>[email protected]</t:PrimarySmtpAddress>
</t:ConnectingSID>
</t:ExchangeImpersonation>
</soap:Header>
<soap:Body>
<m:CreateItem MessageDisposition="SaveOnly">
<m:SavedItemFolderId>
<t:FolderId Id="AQMkAGFjMjFlOTJlLWI3YjYtNDZlMS04MTRkLTYyYWECMTg2MmIzAC4AAAMRJLfC0jQnTqZjTdO9e1KoAQCygVW3rMc4SbvynFv3xnH6AAACAQwAAAA=" />
</m:SavedItemFolderId>
<m:Items>
<t:Message>
<t:Subject>SubjectSample</t:Subject>
<t:Body BodyType="HTML">BodySample</t:Body>
<t:ExtendedProperty>
<t:ExtendedFieldURI PropertyTag="57" PropertyType="SystemTime" />
<t:Value>2017-02-17T16:37:38.000</t:Value>
</t:ExtendedProperty>
<t:ExtendedProperty>
<t:ExtendedFieldURI PropertyTag="3590" PropertyType="SystemTime" />
<t:Value>2017-02-17T16:37:38.000</t:Value>
</t:ExtendedProperty>
<t:ExtendedProperty>
<t:ExtendedFieldURI PropertyTag="3591" PropertyType="Integer" />
<t:Value>1</t:Value>
</t:ExtendedProperty>
<t:From>
<t:Mailbox>
<t:Name>support</t:Name>
<t:EmailAddress>[email protected]</t:EmailAddress>
</t:Mailbox>
</t:From>
<t:IsRead>true</t:IsRead>
</t:Message>
</m:Items>
</m:CreateItem>
</soap:Body>
</soap:Envelope>
When i try to Save this EWS message, i get an error 'Microsoft.Exchange.WebServices.Data.ServiceResponseException' with response code: 'ErrorInvalidExchangeImpersonationHeaderData' and message: 'An ExchangeImpersonation SOAP header must contain a user principal name, user SID, or primary SMTP address'. I use ServiceAccount authentication.
A few days ago it worked fine.