2

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"
Brian Clink
  • 297
  • 2
  • 17
  • How big is your attachment? File reading is a time-consuming operation. Because it is an operation on disk, not memory. – Bruce Nov 13 '18 at 10:05
  • they are less than 1mb – Namig Ismayilov Nov 13 '18 at 13:21
  • You stated your environment is by testing in Chrome. To verify, are you testing this add-in in Outlook on the Web? Are you using the new OWA beta when seeing this behavior? What is the size of the attachment you are adding? – Outlook Add-ins Team - MSFT Nov 13 '18 at 17:36
  • Outlook is not affected (Outlook directly requests the attachment URL). In OWA (IE or Chrome): POST /owa/service.svc?action=CreateAttachmentFromUri&... In Fiddler, the response comes back right away, appears successful, it returns the ID: 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" – Brian Clink Nov 22 '18 at 20:43
  • Browser just sits there for awhile and then reports an error. We've see two different error messages: asyncResult: error: code:9002 message: "There was an internal format error." name: "InternalFormatError" asyncError: code: 9007 message: "The attachment cannot be added to the item." name: "AttachmentUploadGeneralFailure" – Brian Clink Nov 22 '18 at 20:43
  • I'm currently unable to repro. In your original message you indicate that The function succeeds, but takes a long time. In your last comment it fails all the time? Are both things an issue? Or just the errors? Do you have some sample code and attachments that this fails on? (it may be a problem with the attachment itself) – Outlook Add-ins Team - MSFT Nov 27 '18 at 00:04
  • We have edited the question in the last few minutes to clarify the scenario. It is the same group of files we are testing with, and sometimes succeeds and sometimes fails. We don't think it is related to the specific attachment, but we will try testing with other files. – Brian Clink Nov 27 '18 at 15:56
  • What device are you using to test this? (Browser on PC? Mac? Phone?) Is this an issue on all different machines? How many files are you trying to upload at once? – Outlook Add-ins Team - MSFT Nov 28 '18 at 00:54
  • It might also be worthwhile to try the OWA Beta to see if the problems repro? In OWA when an attachment is added the backend server must be able to reach the attachment to add the file. Can you try uploading files to someplace else to see if the problem repros? – Outlook Add-ins Team - MSFT Nov 28 '18 at 02:19
  • In follow-up to my earlier comment, we tried different files now, and smaller files, and see same behavior. We are using IE and Chrome browsers on Windows. We can only upload one file at a time, when the call back returns, we then start the next upload. We will try reproing on different client machines, and try with OOTW (currently we are testing with Exchange 2016 on-premises). The issue is not with the back-end server process, the resulting browser HTTP request that Outlook API triggers returns quickly with a GUID, but we are not notified promptly with the callback in JavaScript. – Brian Clink Nov 28 '18 at 15:19
  • We've been trying to repro this on our end, but can't. This is the script that we've been using: https://pastebin.com/vwXeSHsH (replace showMessage with console.log or something else). Could you try something similar on your end to see if you are hitting the same issues? (or see if replacing the file that is uploaded here with yours to see if that causes the issue). If you have a similar script/files that we can test on our end to see what is happening, that may be helpful, or narrow then where the problem is.The full fiddler traces (.saz file) could help us figure out what is going on as well – Outlook Add-ins Team - MSFT Nov 29 '18 at 01:43
  • Thanks for the assist, we will test additional scenarios and this script and will report back. – Brian Clink Nov 30 '18 at 19:49
  • We discovered it is localized to one dev client machine. We will report back if we find anything further on it - we may just setup a new one. – Brian Clink Dec 06 '18 at 20:10
  • @BrianClink , I have exactly the same problem, after the file is uploaded successfully(the guid also is returning) the callback function is not firing!!. Please tell us if u have reached to any conclusion. – Jalali Shakib May 01 '19 at 11:29
  • @JalaliShakib What browsers are you seeing the issue on? – Brian Clink May 01 '19 at 19:46
  • Also check if the certificate of the web server where the files are being retrieved from is fully trusted by the Exchange Server, and that the name on the certificate of the web server matches the server part of the URL that is being provided. – Brian Clink May 01 '19 at 19:56
  • IE, Chrome and Firefox all of them have this issue but sometimes IE is ok and sometimes not. And the certificates is invalid because its all on-premise and they created it themselves and not bought it from a valid certificate store. I had a hunch that maybe its all about the certificates being invalid, so this is true? and the problem is all about certificates being invalid? – Jalali Shakib May 02 '19 at 04:34
  • We are still seeing the issue but intermittently. When it does 'stall', it seems it takes around 40-45 seconds. We're still doing more testing, but seems like an issue inside of the Outlook JS, that Microsoft can't reproduce. – Brian Clink May 02 '19 at 13:34
  • Well, ours when it does stall it takes around 10 mins! We also must solve this problem and it seems we can't do any straight solution to it and should just past around it somehow. – Jalali Shakib May 04 '19 at 04:24

0 Answers0