Exchange.Contents
An Exchange Online mailbox's mail, calendar, contacts, tasks and meeting requests as tables.
Group: Online services. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Exchange.Contents(optional mailboxAddress as nullable text) as table
| Parameter | Type | Description |
|---|---|---|
mailboxAddress | nullable text optional | A mailbox shared with you; empty or left out: your own. |
Returns
table. A navigation table with a row for each of Mail, Calendar, People, Tasks and Meeting Requests (Name and Data, the key Name); each table is read when it is used.
Remarks
- Each table has a row per item, keyed by Id, with Power BI's columns. Mail: Folder Path, Subject, Sender, DisplayTo, DisplayCc, ToRecipients, CcRecipients, BccRecipients, DateTimeSent, DateTimeReceived, Importance, Categories, IsRead, HasAttachments, Attachments, Preview, Attributes, Body and Id.
- Calendar: Folder Path, Subject, Location, Start, End, DisplayTo, DisplayCc, RequiredAttendees, OptionalAttendees, IsAllDayEvent, LegacyFreeBusyStatus, IsReminderSet, ReminderMinutesBeforeStart, Importance, Categories, HasAttachments, Attachments, Preview, Attributes, Body and Id. Meeting Requests has the same columns and IsCancelled.
- People: Folder Path, DisplayName, Surname, GivenName, MiddleName, CompanyName, JobTitle, FileAs, OfficeLocation, EmailAddresses, ImAddresses, PhoneNumbers, Categories, HasAttachments, Attachments, Notes, Preview, Attributes, Body and Id. Tasks, from Microsoft To Do (the list's name is the Folder Path): Subject, StartDate, DueDate, the reminder, Status, PercentComplete, Owner, IsRecurring, Recurrence, IsComplete and the columns every table has.
- Sender, Body and Attributes are records; the recipients, attendees and Attachments are tables, an attachment's content read when it is used. Times are datetimes in UTC.
- The mailbox is read through Microsoft Graph. Signed in with your Microsoft work account: the studio asks the first time this computer reads the source, and keeps the sign-in on this computer only.
Compared with Power Query
Power BI Desktop reads a mailbox through Exchange Web Services, OpenBI through Microsoft Graph. The tables, their columns and types are Power BI's; a value Graph doesn't hold, such as most of Attributes, is null.
Examples
The tables of a mailbox
Exchange.Contents()[Name]
{"Mail", "Calendar", "People", "Tasks", "Meeting Requests"}
The list of tables needs no sign-in; reading one does.
Your own mail
Exchange.Contents(){[Name = "Mail"]}[Data]
Result: not shown here: it needs an Exchange Online mailbox and a sign-in.
A shared mailbox's calendar
Exchange.Contents("sales@norwayanalytics.no"){[Name = "Calendar"]}[Data]
Result: not shown here: it needs an Exchange Online mailbox and a sign-in.