Search code examples
outlookadd-inoutlook-addinoffice-jsjavascript-api-for-office

Is it possible to get data of several selected mails inside an outlook web add-in app?


inside a Outlook COM Add-in (C#) I was able to retrieve all selected mails inside Outlook like this

var selection = Globals.ThisAddIn.Application.ActiveExplorer().Selection;
List<Outlook.MailItem> outlookMailList = new List<Outlook.MailItem>();
foreach (object mail in selection)
  outlookMailList.Add((Outlook.MailItem)mail);

to store the selected mails with some meta data inside a DMS.

Now I would like to do the same with the Javascript API for Office (office.js).

  1. What is the correct entry point here? Because when I select more than one mail inside Outlook the OutlookTab-buttons inside the default ribbon get deactivated.

see also http://bettersolutions.com/javascript-api/hosts/extensionpoint.htm

  1. For retrieving the mail information I have found

selectedMail = Office.context.mailbox.item;

How can I get now the data for all marked mails in Outlook. I expected to have something like

selectedMails = Office.context.mailbox.items;
// OR
selectedMails = Office.context.mailbox.selectedItems;

Does someone know how to retrieve the information which mails were selected to the TaskPane or maybe a CustomPane? Respectively if it is even possible? Thanks a lot.


Solution

  • Unfortunately Office JS API built for handling a single item. Handling multiple items is not possible.

    If this is a new feature you want to include in the future, you may submit a feedback.

    https://officespdev.uservoice.com/

    Best regards