Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
692 views
in Technique[技术] by (71.8m points)

c# - using ExtendedProperties in the Outlook REST API to set Message item headers

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:

enter image description here

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 ˉ_(ツ)_/ˉ

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...