Setting properties by way of EWS on a Draft message in a Compose Mail App With the most recent updates which have been launched just lately for Compose apps that at the moment are obtainable in OWA in Workplace365 and the Workplace/Alternate 16 preview the flexibility to increase what your compose apps can do has been enormously enhanced. With model 1.three of the API now you can save an Merchandise by way of the saveAsync methodology https://msdn.microsoft.com/en-us/library/workplace/mt269096.aspx .
Why this small change is necessary from an extensibility viewpoint is that once you save an Merchandise this manner, it creates a draft within the Mailbox you activated the compose app from which you’ll then modify anyway you want utilizing the EWS updateItem operation. (usually you’d be restricted in a compose app to only utilizing the subset of properties and strategies supplied for within the Workplace.js).
One trick nonetheless is the ItemId which that you must make an UpdateItem EWS Request to replace the Draft Merchandise remains to be solely obtainable in Learn Mode. So to get round this I’ve give you the next workaround
- Set a customized property on the draft Merchandise utilizing the Mail App Customized properties methodology utilizing one thing like https://msdn.microsoft.com/EN-US/library/workplace/fp142263.aspx . With my Mail Apps I generate a brand new GUID for the app session that I exploit as the worth.
- Save the Merchandise your composing as a Draft utilizing saveAync
- Now you need to use makeEwsRequestAsync to do a findItems on the drafts folder of the Mailbox with a restriction so it solely finds the Merchandise with the Customized property you may have set. The Customized properties you’ll be able to set in the Mail App API are documented in https://msdn.microsoft.com/en-us/library/hh968549(v=exchg.80).aspx . However principally what you may have is they’re a named property inside the PS_PUBLIC_STRING propset of kind String. The property identify of the property is prefixed with cecp- and remainder of the property identify is the GUID of your Mail Apps as outlined within the software’s manifest Id .
- After getting the ItemId and Change key you’ll be able to then use UpdateItem in EWS to replace any of the prolonged or strongly kind properties on the draft Message.
One factor to notice to make use of this workaround your Mail App wants the ReadWriteMailbox privilege to permit using the EWS Operations. I’ve put collectively a pattern of utilizing this workaround in my OWA Voting button app.
Additionally as a result of that is utilizing model 1.three of the Mail App Api it’s best to set the necessities within the Manifest file of your software eg
<Set MinVersion="1.3" Title="Mailbox"></Set>
This can imply your Mail App will solely activate in shoppers that assist model 1.three which suggests in the mean time it will not activate in Outlook 2013.