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

Office.context.mailbox.item is undefined in shared mailbox #4852

Open ChibaniMohamed opened 2 months ago

ChibaniMohamed commented 2 months ago

I'm developing an Outlook Add-in using : "@microsoft/office-js": "^1.1.93"

Your Environment

Expected behavior

Office.context.mailbox.item should return an object

Current behavior

Item is always undefined when i select it from shared mailboxes or shared folders (Outlook classic only)

zhngx1 commented 2 months ago

Can you follow the docs here for referencing Office.js instead of using the package? https://learn.microsoft.com/en-us/office/dev/add-ins/develop/understanding-the-javascript-api-for-office#accessing-the-office-javascript-api-library

ingin97 commented 3 weeks ago

@zhngx1 We are also experiencing this exact problem. Only applies to shared folders on Outlook classic like the author reported. We are using the CDN to office.js as you asked the author to check. Anything else you need to speed up the processing time? Or do you know of any other ways to retrieve the email?

We are also experiencing an error when trying to retrieve an auth token for the shared folder email: A REST token is only available with ReadWriteMailbox permission when there is no item context. Even though we are using Office.context.mailbox.getCallbackTokenAsync({isRest: false}). Not sure if you can use this in the context for solving the problem, or if it is a seperate issue.

ChibaniMohamed commented 2 weeks ago

Any updates on this issue ? We are still facing the same problem .

ChibaniMohamed commented 1 week ago

@zhngx1 ?

ingin97 commented 1 week ago

For us this ended up being because of the fact that the mailbox was hidden in GAL.

zhngx1 commented 5 days ago

@ingin97 Do you still have issue with item being undefined in shared mailbox? Seems that the you no longer have the issue with the getCallbackTokenAsyncAPI, is that correct?

@ChibaniMohamed Did you switch to referencing the office.js through CDN instead of the microsoft/office-js and still seeing the item being undefined?

zhngx1 commented 5 days ago

I am reopening the issue.

ChibaniMohamed commented 5 days ago

I tried to add the mailbox in GAL and now it works , thank you .