OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
682 stars 95 forks source link

Outlook: OnSend add-in is not sending appointments on first attempt #943

Closed sourabhkrishna closed 4 years ago

sourabhkrishna commented 4 years ago

OnSend Add In for Meetings/Appointments doesnt send in the first call

Expected Behavior

When I click send on my OnSend Add-In popup , the appointment needs to be sent.

Current Behavior

But I'm having to trigger the addin twice and it creates 2 events in my calendar, First event is just saved while second event is actually send.

Steps to Reproduce, or Live Example

Attached the video replication for example

Capture

having set the event.completed to true is not sending the invite.

Calendar - Krishna, Sourabh - Outlook - Google Chrome 2020-01-21 19-06-01.zip

exextoc commented 4 years ago

OnSend Add In for Meetings/Appointments doesnt send in the first call

Expected Behavior

When I click send on my OnSend Add-In popup , the appointment needs to be sent.

Current Behavior

But I'm having to trigger the addin twice and it creates 2 events in my calendar, First event is just saved while second event is actually send.

Steps to Reproduce, or Live Example

Attached the video replication for example

Capture

having set the event.completed to true is not sending the invite.

  • Platform [PC desktop, Mac, iOS, Office Online]: OWA
  • Host [Excel, Word, PowerPoint, etc.]: Outlook
  • Browser (if using Office Online): Chrome

Calendar - Krishna, Sourabh - Outlook - Google Chrome 2020-01-21 19-06-01.zip

Would you be able to send either your add-in or a simplified version of it, along with whatever else I might need to repro the issue? The demo add-ins I have all still work with OnSend so I need more information to repro.

sourabhkrishna commented 4 years ago

Sure . PFA the sample onSend App with manifest. onSendSampleAddin.zip

Here is the scenario , it would fail. When I click send I'm performing an saveAsync inorder to use the getCallbackTokenAsync method. I need this token for my custom API to talk to Exchange server using EWS API to fetch mail/appointment details on the server for validations.

If I do not perform the saveAsync , click send would work the normal way and on instance the appointment is sent , but my API would fail since it was not able to fetch the mail details from EWS using the getCallbackTokenAsync Token as this value is now null.

exextoc commented 4 years ago

Sure . PFA the sample onSend App with manifest. onSendSampleAddin.zip

Here is the scenario , it would fail. When I click send I'm performing an saveAsync inorder to use the getCallbackTokenAsync method. I need this token for my custom API to talk to Exchange server using EWS API to fetch mail/appointment details on the server for validations.

If I do not perform the saveAsync , click send would work the normal way and on instance the appointment is sent , but my API would fail since it was not able to fetch the mail details from EWS using the getCallbackTokenAsync Token as this value is now null.

Does it mean that the failure to send on one attempt occurs when used with saveAsync? Does the token is successfully fetched?

sourabhkrishna commented 4 years ago

Yes , onSaveAsync the token is generated. Since Appointments do not have an Draft State , the appointment is saved in the user calendar, but on event.completed(true) the appointment inst sent. But the one the second instance of same scenario , the appointment is sent.

exextoc commented 4 years ago

This scenario occurs when calling Office.context.mailbox.item.saveAsync on a new Calendar item that has not been sent yet. This is a known issue and we are looking into a solution to resolve this so that the API can be used as designed. The API should behave as designed in Mail and on Existing Calendar items. Note that for existing Calendar items, an update may be sent out to attendees depending on the changes that the user or the add-in made in the compose form.