3

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.

Hans
  • 33
  • 4

1 Answers1

6

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

Slava Ivanov
  • 6,666
  • 2
  • 23
  • 34
  • Is there any updates on this? Does now Office JS API supports multiple emails selection? – Aakash Maurya Apr 18 '19 at 08:04
  • 2
    @AakashMaurya According to latest [Office Preview Requirement Set](https://learn.microsoft.com/en-us/office/dev/add-ins/reference/objectmodel/preview-requirement-set/office.context.mailbox.item?view=office-js) there is no object which handles several items. Everything is still around one item at the time. – Slava Ivanov Apr 18 '19 at 13:52