Attachments missing on the EWS server for draft email saved via Outlook OfficeJS

226 Views Asked by At

I am using the Office.context.mailbox.item.saveAsync method for saving a draft email. This method returns itemId which I later use to make a call to the EWS server to retrieve the email eml content, but the returned eml content is missing some of the attachments.

This is only happening on the Desktop App (Outlook 2013) with cache mode enabled. When using Outlook on the Web it works correctly.

I am using ews-java-api to retrieve the email from the EWS.

Is there a way to know when the email saving is finished? I can't use the Office.context.mailbox.item.saveAsync.makeEwsRequestAsync because of the 1MB response limitation.

2

There are 2 best solutions below

2
Slava Ivanov On

Is there a way to know when the email saving is finished?

If the following: "Is there a way to know when the email saving is finished?" is your question, than the answer is No. You may try the ugly solution, when you use sub-sequential EWS query with Id you've got from saveAsync in the loop and wait for success. This may take, depend on environment, from a few seconds to like half a minute easily. Not sure if your customers (users) will wait for so long, when add-in finally respond.

You may get more information from the topic: App for Outlook: EWS request failed with item Id returned by item.saveAsync on compose new message

EDIT:

Simple GetItem request can be used as follow ...

<GetItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
    <ItemShape>
        <t:BaseShape>IdOnly</t:BaseShape>
    </ItemShape>
    <ItemIds><t:ItemId Id="' + itemId + '"/></ItemIds>
</GetItem>

The request should return ChangeKey if item was created on exchange.

0
AudioBubble On

In Cached mode it will take time for the item to sync up to the server. People usually poll until the data they want is there. Also, they can write a custom property, and check for that property to make sure their item is up to date if necessary. You can find some details about custom property here: Client Extension Message Object Protocol, Mail App Custom Properties and Mail App Accesses Custom Properties