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
690 stars 95 forks source link

[Outlook Add-in] How to capture the change of required attendees on Scheduling Assistant Tab? #3981

Open hazal2024 opened 11 months ago

hazal2024 commented 11 months ago

Background Currently, we are developing an Outllok add-in using this template to show the required attendees and relevant meeting information in taskpane. We are using Office.context.mailbox.item.requiredAttendees to get the required attendees of the appointment, and addHandlerAsync to get the change of thre required attendees, and use it to update the add-in in a real-time way.

taskpane.js

Office.onReady((info) => {
    if (info.host === Office.HostType.Outlook) {
      document.getElementById("sideload-msg").style.display = "none";
      document.getElementById("app-body").style.display = "flex";
      item = Office.context.mailbox.item;  

      //function to show the required attendees and relevant meeting information in taskpane
      updateTaskpaneContent();

      //Capture the change in attendees and update the taskpane
      item.addHandlerAsync(
        Office.EventType.RecipientsChanged,()=>{
          updateTaskpaneContent();
        }
      );

      //Capture the change in dureation and update the taskpane
      item.addHandlerAsync(
        Office.EventType.AppointmentTimeChanged,()=>{
          updateTaskpaneContent();
        }
      );
    }
  });

Problem It worked fine in Meeting tab but in Scheduling Assistant tab, the event handler cannot be triggered when the attendees are changed (Image below). MicrosoftTeams-image

Expected Behaviour The following are what I want to achive:

  1. When I add a required attendee from Scheduling Assistant tab, the event handler should be triggered.
  2. When I uncheck the checkbox in front of the attendee from Scheduling Assistant tab, the event handler should also be triggered. (p1)
  3. When I delete the attendee from Shceduling Assistant tab, the event handler should be triggered.
davidchesnut commented 10 months ago

Hi @hazal2024, thanks for raising this issue. @exextoc can you help look into this issue please? thanks!

Oleg-O commented 10 months ago

Thank you for bringing it to our attention. We're discussing this internally. I'll update this post with the outcome. Internal Tracking ID: office:8659872

rykoma commented 10 months ago

I think that the issue is the task pane launched in Meeting page is not hidden even though the user moved to the Scheduling Assistant page. Task pane of add-in should not be available in the Scheduling Assistant page.

In fact, there is no way to launch the task pane of add-in in the Scheduling Assistant page. This is the same for all Outlook (Classic Outlook for Windows, Outlook on the Web and New Outlook for Windows). And, in Outlook on the Web and New Outlook for Windows, the task pane launched in Event page will be hidden when the user moved to the Scheduling Assistant page.

Oleg-O commented 10 months ago

Good observation @rykoma. Note though, in Classic Outlook, the add-in pane stays open in all cases, for example, in mail read and compose scenarios, if you open an add-in and switch to another ribbon tab, the add-in will stay open even though the add-in ribbon buttons disappear so there is no way to re-open it from that ribbon tab if you happen to close the add-in.

Scheduling tab has challenges given it changes the form completely, which makes some APIs problematic from implementation and user experience perspective. These are the things we need to consider when we come with a solution.

Indeed, one simple solution here could be just closing the add-in for the Scheduling page, similar to how Outlook on the Web does it. Would this be an acceptable solution for your add-in, @hazal2024?

hazal2024 commented 10 months ago

@Oleg-O, @rykoma Thank you for the response!! It explained a lot. Is there any method/interface for classic Outlook to detect that the user is currently on Scheduling Assistant Tab and then hide the taskpane automatically??

hazal2024 commented 10 months ago

Also, to us, many users are using classic Outlook and will schedule the meeting from Scheduing Assistant tab, so hiding the pane should be a temporary solution. We suppose the add-ins should support each of the tabs in OWA, unless that is specifically not allowed...

rykoma commented 10 months ago

@hazal2024 You can close the task pane by running Office.context.ui.closeContainer(). But unfortunately, there is no API to detect whether the user is using the Scheduling Assistant tab or not.

In my opinion, Microsoft need to fix the behavior of Classic Outlook for Windows to hide the task pane when the user moved to Scheduling Assistant tab. On the other hand, I think it's a good option that the developer of add-in prepares a note on the task pane as a temporary solution which mentions that the add-in is not fully operational while the user is using the Scheduling Assistant.