问题
It is possible to request message headers in the C# API:
https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.item.internetmessageheaders(exchg.80).aspx
Is it possible to set item message headers instead, using the REST API via ExtendedProperties
?
This would allow us to remove the last remaining EWS SOAP call we have to do, which is to add a header to an Outlook draft.
The reasons for wanting this:
- Apparently the EWS SOAP API seems to have a failure rate of 10 - 20% of the time, which is a lot:
these are the response headers from a recent failed SOAP request to set item headers:
HTTP/2.0 200 OK
cache-control: no-cache, no-store
pragma: no-cache
content-length: 292
content-type: application/json; charset=utf-8
content-encoding: gzip
expires: -1
vary: Accept-Encoding
p3p: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
set-cookie: OpenIdConnect.token.v1=AQAAAOADAADFvAnVWFaCHx5XIFrC14By45JdwIaJciEmq6QxjeEkDuu2FkvvzPTFQT48FfepaPUSJwOYaWPsN17BxG86W2EdRhra3LCEm0I7uqQ==; path=/; secure; HttpOnly
X-OWA-CANARY=rLiI6SI6hEG8TKmFC33h0nDLEd7HytUY6h5Nd5-yklT1lwE6CMOtZ4E6DlBkS8aT6hvMlUUzYRM.; path=/; secure
request-id: c1fcc6a9-e5f7-4376-8601-ed818121c114
x-calculatedbetarget: VI1PR01MB1245.eurprd01.prod.exchangelabs.com
x-backendhttpstatus: 200
x-rum-validated: 1
x-content-type-options: nosniff
x-ms-appid: 00000002-0000-0ff1-ce00-000000000000
x-owa-version: 15.20.820.15
x-owa-owsversion: V2018_01_18
x-owa-minimumsupportedowsversion: V2_6
x-owa-httphandler: true
x-owa-diagnosticsinfo: 83;0;0
x-owa-correlationid: EEA57A52016E48BD82069FA4CF1379A5_152819141147695
x-owa-clientbegin: 2018-06-05T09:36:51.476
x-frontend-begin: 2018-06-05T09:36:51.464
x-backend-begin: 2018-06-05T09:36:51.564
x-backend-end: 2018-06-05T09:36:51.658
x-diaginfo: VI1PR01MB1245
x-beserver: VI1PR01MB1245
x-ua-compatible: IE=EmulateIE7
strict-transport-security: max-age=31536000; includeSubDomains
x-frontend-end: 2018-06-05T09:36:51.651
x-powered-by: ASP.NET
x-feserver: VI1PR0101CA0061
x-msedge-ref: Ref A: 9251B1F610474C6F83A4DEFEA3C14797 Ref B: AMS04EDGE0917 Ref C: 2018-06-05T09:36:51Z
date: Tue, 05 Jun 2018 09:36:51 GMT
X-Firefox-Spdy: h2
- Not having to mix and match EWS SOAP API and REST API requests and remove SOAP XML related code.
Related: extendedProperties sample request in REST API sandbox fails ¯_(ツ)_/¯
回答1:
I am curious about the 10-20% failure rate you are seeing with the EWS API. What failures are you seeing?
As for setting headers, REST actually uses the EWS business logic under the covers, so what worked in EWS should also work in REST (with some exceptions). For instance, you should be able to follow the below via REST extended props:
https://msdn.microsoft.com/en-us/library/office/dn596091(v=exchg.150).aspx
来源:https://stackoverflow.com/questions/49552123/using-extendedproperties-in-the-outlook-rest-api-to-set-message-item-headers