I have been experiencing very inconsistent behavior with this call. Sometimes it succeeds, sometimes fails, but always takes a long time with the Outlook Web client.
We have seen this in dev, on production, with IE and Chrome browsers. Outlook is not affected. The back-end is Exchange 2016.
I pass the parameters (in my case it is url is query string that has filepath, filename and some other variables) to Office.context.mailbox.item.addFileAttachmentAsync. It triggers GET request and it goes ahead and reads file to stream in no time.
I looked into iis logs and looks like these GET requests are pretty quick, under 2 seconds. (time-taken value for each call is highlihted)
In Fiddler, we see the request that gets triggered by the Outlook API is: POST /owa/service.svc?action=CreateAttachmentFromUri&... In Fiddler, the response comes back right away, appears successful, it returns the GUID: HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 X-OWA-Version: 15.1.1531.7 Content-Length: 38 "cd97a9c7-31e2-41b4-bf0d-39ac2450de39"
Although the response returns quickly, the callback is not called promptly.
We have to add one attachment at a time, and it takes up to a minute before the first callback returns, so we can then make the call to add the next attachment. Often the callback returns with an error.
When it returns with an error, we've seen two different kinds of errors:
- asyncResult: error: code:9002 message: "There was an internal format error." name: "InternalFormatError"
- asyncError: error: code: 9007 message: "The attachment cannot be added to the item." name: "AttachmentUploadGeneralFailure"