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
670 stars 96 forks source link

Outlook getSelectedItemsAsync throws elevated permission error (Office on the web) #3914

Closed manuelsidler closed 9 months ago

manuelsidler commented 9 months ago

Your Environment

Expected behavior

When selecting multiple items and calling Office.context.mailbox.getSelectedItemsAsync, it should return the selected items.

Current behavior

When running the add-in on Outlook on the web, calling Office.context.mailbox.getSelectedItemsAsync throws an error:

image

Steps to reproduce

  1. Clone the example GH repo to reproduce the issue (see link below)
  2. Run the add-in with npm install and npm run dev-server
  3. Side load the add-in on Outlook on the web
  4. Select multiple items
  5. Open the add-in
  6. Click the Get selected items button
  7. Open the developer tools
  8. The console contains the error (see screenshot above)

The same steps on Outlook for Mac work fine.

Link to live example(s)

Context

The permissions in the manifest are set to ReadWriteMailbox

exextoc commented 9 months ago

@manuelsidler We do not have a repro of this issue with your add-in. On clicking Get Selected Items, Add-in is displaying the selected Item info both on OWA and Mac.

image

Is the issue occurring intermittently? It would help if you can share a repro video.

manuelsidler commented 9 months ago

@exextoc thank you for taking time to investigate our issue. The error occurs every time when calling getSelectedItemsAsync. I also tried it on Edge on Windows. Please find attached the video.

https://github.com/OfficeDev/office-js/assets/802015/be97767d-7419-41a7-b22b-30f4c5bbb581

exextoc commented 9 months ago

@manuelsidler We have recently checked in a fix for this issue and fix will be 100% rolled out by end of week. Please try this again next week and let us know if issue persists.

CameronDwyer commented 9 months ago

I've been blocked with this issue as well. Great to see a fix has been worked on. I look forward to it rolling out and giving it a test.

manuelsidler commented 9 months ago

@exextoc the issue has been fixed, thank you!

JonasBjerke89 commented 8 months ago

I did experience the same issue back in December both in OWA + PWA versions of Outlook, but it worked before then we did the actual implementation of "supportsMulti" in November.

The issue doesn't seem to be resolved (sorry for the danish): image

Anyone else still seeing this issue?

kirtisuri commented 6 months ago

This issue is happening when we are using other regular user except for Global admin and Outlook on web. For Global admin it works fine. In the manifest have the permission set as ReadWriteMailbox.

For regular user. When selecting multiple emails the event handler that we use to get the selected items does not consistently return the selected email items. The Outlook getSelectedItemsAsync throws "Internal error has occured". The error does not have any specific error codes. Is it that the manifest I am using does not have the fixes that were done by Microsoft recently? How to make sure I am using the later version of Office.js In my html page I have

Here is the screenshot of the error:

error

Is there any specific permission that is needed. For regular users? I tried to check the Office.context.mailbox.initialData and the permission level is set as 3 for this user.

JonasBjerke89 commented 6 months ago

Changed manifest permission to "ReadWriteMailbox". Updated, waited a few days and our client reports back that it works as expected in Outlook web and Outlook New 💪

kirtisuri commented 6 months ago

@JonasBjerke89 What is the version you specified in the manifest file ?