Search code examples
outlookoffice-jsoutlook-addinoffice-addinsoutlook-web-addins

Listing All Emails in Inbox by Outlook Web Addin


I am able to get details of previewed email by this JavaScript command:

console.log(Office.context.mailbox.item);

But I need to list all emails in the inbox (not only previewed one) by using Office JS, is it possible, if so how can I do it? (Its also okay receiving details from specified ID or e-mail number, if possible.)

Thanks!


Solution

  • No, it is not possible. Office web add-ins work under the context of currently selected item in Outlook only. If you need to access other items in the user's mailbox I'd suggest using Graph API, see Outlook mail API overview and Authorize to Microsoft Graph with SSO for more information.

    Also you don't forget that VSTO based add-ins allows dealing with all items in Outlook stores. See Walkthrough: Create your first VSTO Add-in for Outlook for more information.

    Feature requests on Tech Community are considered, when the dev team go through the planning process. Use the github label: “Type: product feature request” at https://aka.ms/M365dev-suggestions .