0

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.

N8888
  • 670
  • 2
  • 14
  • 20
CL_3000
  • 71
  • 1
  • 4
  • This is not possible today. However, we track Outlook add-in feature requests on our user-voice page [link](https://officespdev.uservoice.com/forums/224641-general/category/131778-outlook-add-ins) It looks like the feature you want has been requested by others already. Please upvote the existing request [link](https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback/suggestions/34593391-immediate-synced-to-the-server-saveasync-to-get). Feature requests on user-voice are considered when we go through our planning process. – Outlook Add-ins Team - MSFT Aug 16 '18 at 18:49

2 Answers2

1

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.

Slava Ivanov
  • 6,666
  • 2
  • 23
  • 34
  • Hi @SlavaIvanov, thanks for the quick answer. Can you give me an example of which query to use to check if the message is saved? I read the post, but could not find anything specifically for that query. – CL_3000 Aug 04 '18 at 10:36
  • @BorchePetrovski I have edited my answer, please have a look. – Slava Ivanov Aug 07 '18 at 13:20
1

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