Repository navigation
Releases: Nico77600/MailboxMessageReport
Release list
Mailbox Message Report 2.1.0
Large folders read 4 requests at a time to the end, a progress bar that shows the messages read, and the read state in the HTML report. Read only.
Faster on large folders
- Slices of the same number of messages: a folder of more than
Graph.SplitFolderItemsmessages (now 2,000, 5,000 before) is cut at the dates of the messages at 1/n, 2/n... of the folder ($top=1&$count=true, then$top=1&$skip=k·N/n), 16 slices at most. Version 2.0 cut the period in equal parts: a room's Deleted Items had 39,372 of its 39,419 messages in 3 days of 6 months, so one slice held almost all of them and was read one page after the other. - Slices cut again while read: when a mailbox has free request slots (Exchange Online answers 4 at a time per mailbox), the list with the longest period left is cut in two (the list in course stops at the cut, a new slice reads the older half). Every message is read once, newest first.
| Lab: Deleted Items of a room, 6 months, with the recipients | 2.0.0 | 2.1.0 |
|---|---|---|
| Duration | 14 min 06 s | 3 min 08 s |
| Messages a second | 47 | 214 |
| Requests at a time | 1 at the end | 3.9 on average (Exchange allows 4 per mailbox) |
Progress and speed
- Progress bar: the share of the messages read, folder by folder (the number of messages of the filter of each list,
$counton its first page), with the messages a second and the time left. Version 2.0 counted the empty slices of a folder as read: the bar stayed at 100 %. - Speed in the log: the time of a page (average, longest), the requests in flight on average, the messages a second of the run and of each mailbox, the 5 slowest folders. New column Seconds in
Folders.csv, Read in in the Folders tab of the HTML report.
HTML report
- A Read column in the table of the messages (No in colour; the subject of an unread message in bold, as in Outlook) and a Read filter (all, read, unread), with the others.
Validated
- 38 Pester tests (cuts at k·N/n, a folder whose messages came in a few days, a slice cut again while read, the progress, the read state).
- Lab tenant: Exchange Online
$count(0.4 s) and$skipup to 30,000 (4 s at most) measured; the folder above read in 3 min 08 s, 39,414 messages, each once, newest first, with their recipients; the progress of a real run (2 %, 8 %, 27 %, 42 %... 100 %).
Upgrade
Take the configuration file of the package (Graph.SplitFolderItems = 2000). An older configuration file works, with its value.
Unblock the files after downloading: Get-ChildItem "C:\Chemin\Du\Dossier" -Recurse -File -Force | Unblock-File.
Guides: docs\MailboxMessageReport-UserGuide.html and docs\MailboxMessageReport-Guide.html in the zip.
Mailbox Message Report 2.0.0
Every message in the HTML report, and a CSV file Excel always opens. Read only. The format of the reports changes (new column, new HTML report): MAJOR version.
HTML report
The design of the HTML report of Purview DLP Report:
- Every message, up to
Report.HtmlMaxMessages(now 500,000 by default, 0 to 2,000,000; 20,000 before), in compressed blocks of 20,000 (JSON, gzip, base64; folders, subjects, addresses, names and types stored once in dictionaries), decompressed by the page into typed arrays. - A table that draws only the visible rows: it scrolls through hundreds of thousands of messages at once.
- Filters, together: every field, mailbox, location (primary mailbox, archive, Recoverable Items), folder, sender, subject, recipient (To, Cc, Bcc), Internet message ID, received dates, minimum of recipients, with attachments.
- Sort by a click on a column; every recipient of a message in its detail (To, Cc, Bcc, with Copy); Export the view to CSV.
| Messages (synthetic) | HTML | Opens in | Search | Memory of the page |
|---|---|---|---|---|
| 200,000 | 6.5 MB | 1.1 s | 0.1 s | 55 MB |
| 1,000,000 | 32 MB | 4.1 s | 0.3 s | 305 MB |
Version 1.x: 200,000 messages in 118 MB, 200 rows at a time. Real messages (longer message IDs, more subjects): count two to three times these sizes.
CSV safe for Excel
- A cell is never longer than an Excel cell (32,767 characters). A message sent to 10,000 people broke the row in Excel (4 rows × 8,750 columns, measured): a list of recipients is now cut after its last whole address, with the number of the others (
… (+8,739 more)), one row of 23 columns. - New column
RecipientCount(To + Cc + Bcc; empty with-SkipRecipients) afterBcc.
Validated
- 36 Pester tests (the blocks of the HTML report decoded as the page does; a message of 10,000 recipients).
- Excel through COM (the CSV with 10,000 recipients); Microsoft Edge (200,000 and 1,000,000 messages); lab tenant: 5,275 messages of two mailboxes and their archives, filters, sort, detail and export.
Upgrade
Take the configuration file of the package (or set Report.HtmlMaxMessages = 500000). The page needs a recent Microsoft Edge, Google Chrome or Firefox (DecompressionStream): not Internet Explorer mode, not the preview of OneDrive or SharePoint.
Unblock the files after downloading: Get-ChildItem "C:\Chemin\Du\Dossier" -Recurse -File -Force | Unblock-File.
Guides: docs\MailboxMessageReport-UserGuide.html and docs\MailboxMessageReport-Guide.html in the zip.
Mailbox Message Report 1.1.1
A fix for pages cut short by Exchange Online. Read only. No change of configuration or report format.
Fixed
- A page cut short no longer stops the run. Exchange Online sometimes answers a page of messages with a status 200 and a JSON that ends early (seen on a tenant on a slice of a large folder:
Exception calling "AddPage"... Expected depth to be zero at the end of the JSON payload; 1.0.0 and 1.1.0 stopped without a report). The page is now asked again once; then with half as many messages, down to one (the next pages grow back toGraph.PageSize); then that one message without its sender and recipients; at last it is left out and the list goes on. - Each step is logged (Graph answered a page cut short). A message left out, or read without sender and recipients, is counted in the Detail of its folder (Folders tab) and the run finishes with warnings (exit code 2).
- A list of folders cut short is asked again (
Graph.MaxRetries), never kept incomplete.
Improved
- Large folders: the newest slice has no end and the oldest no start (but those of the period asked), so a message newer or older than the two dates read first is read as well.
- HTML report: a notice when the browser cannot run its script (scripts turned off, Internet Explorer mode, a preview) instead of an empty page.
- The log of a search from the window gives the recipients asked, the formats and the layout of the report.
Validated
- 35 Pester tests on a simulated Exchange Online tenant, with pages cut short: a message Exchange cannot return (with or without its recipients), pages too large, a page and a list of folders cut once.
- Lab tenant:
$filterwithreceivedDateTime ltorgealone accepted with$orderby; nextLinks in$top/$skip,$skiphonoured; a folder of 39,419 meeting messages read in 8 slices, 39,434 messages each once.
Workaround with 1.0.0 / 1.1.0: untick Recipients (-SkipRecipients) or set Graph.PageSize = 100.
Unblock the files after downloading: Get-ChildItem "C:\Chemin\Du\Dossier" -Recurse -File -Force | Unblock-File.
Guides: docs\MailboxMessageReport-UserGuide.html and docs\MailboxMessageReport-Guide.html in the zip.
Mailbox Message Report 1.1.0
The preview of the window, like Outlook: the folders of each mailbox and of its archive, the first messages of each folder, and a reading pane. The reports do not change. Read only.
Added
- Folder view: the tree of each mailbox read — Primary mailbox, Archive and, when read, Recoverable Items under each — with the messages found per folder (a folder without any greyed, a folder not read in red); the messages of the folder selected (sender, subject, date, attachment), newest first; the first folder with messages selected after a search.
- Reading pane: subject, sender, To, Cc, Bcc, received and sent dates, location and folder, Internet message ID, and the content of the message selected, read then from Microsoft Graph as text (
GET /users/{id}/messages/{id}?$select=body), one message at a time, kept for the rest of the session. - Preview per folder: the first 10 messages of each folder (
Window.PreviewPerFolder), 5,000 in all at most (Window.PreviewMessages, 1,000 before); List shows the same messages in one sortable list.
Permissions
The content of a message needs the application permission Mail.Read. With Mail.ReadBasic.All only, the reading pane says so and shows everything else. Each content read is written to the log (mailbox, location, folder, Internet message ID); Window.ReadBody = $false turns it off. The reports never hold the content, the attachments are never read.
Validated
- 33 Pester tests on a simulated Exchange Online tenant (the first messages of each folder, the folder tree, the folder view, the reading pane).
- Lab tenant: 3 mailboxes, 963 messages; 150 messages in the folder view (the first 10 of each folder), the content of a message read as text in the reading pane.
Requirements
PowerShell 7.4+ on Windows 10 / 11 or Windows Server 2016 to 2025, Exchange Online, an application registered in Microsoft Entra with Mail.ReadBasic.All and User.Read.All (application permissions, admin consent) and a certificate; Mail.Read for the content in the reading pane. Not the auxiliary archives of an auto-expanding archive; settings/exchange is a beta endpoint of Graph.
Unblock the files after downloading: Get-ChildItem "C:\Chemin\Du\Dossier" -Recurse -File -Force | Unblock-File.
Guides: docs\MailboxMessageReport-UserGuide.html and docs\MailboxMessageReport-Guide.html in the zip.
Mailbox Message Report 1.0.0
First version: the messages of the primary mailbox and the In-Place Archive of Exchange Online mailboxes — and Recoverable Items — through Microsoft Graph only. No Exchange Online PowerShell, no export. Read only.
Added
- The archive through Microsoft Graph:
GET /beta/users/{id}/settings/exchangegivesinPlaceArchiveMailboxId=MBX:<ArchiveGuid>@<tenant ID>(the same GUID asArchiveGuidofGet-EXOMailbox), and the archive is read like a mailbox:/users/MBX:.../mailFolders/delta,/mailFolders/{id}/messages. WithoutUser.Read.All, a CSV list can give theArchiveGuidof each mailbox. - Recoverable Items (
-IncludeRecoverableItems): Deletions, Purges, Versions, DiscoveryHolds, SubstrateHolds, Calendar Logging, of the primary mailbox and of the archive. - Every message: mailbox, location (Primary / Archive), Recoverable Items, folder path and name, received and sent date and time, subject, from, sender, To, Cc, Bcc, Internet message ID, attachments, importance, read, type, item ID.
- Filters of Exchange: the period (
-Start,-End, received date), the subjects (-Subject, any of them), written the way Exchange accepts them (the date first, thencontains(): InefficientFilter otherwise); folders left out (-ExcludeFolder);-SkipRecipientsfor large folders of meeting messages. - One mailbox or thousands:
-Mailbox(any alias, UPN) or-MailboxFile(text, or CSV withArchiveGuid); a mailbox on-premises, inactive, not found or denied is reported with its reason. - Large mailboxes: 16 requests in flight, 4 at a time per mailbox (a primary mailbox and its archive are two mailboxes); a folder of more than 5,000 items read in slices of its dates, side by side; each page written to disk at once by a compiled writer — the memory does not grow with the messages.
- Reports:
Messages.csv(every message, safe for Excel),Mailboxes.csv,Folders.csv,Summary.json, a self-contained HTML report (messages, folders, mailboxes) with the first 20,000 messages — up to 200,000 with-HtmlMaxMessages(118 MB, open in about 3 s, search and sort under a second);-Layout Global,PerMailbox(one report per mailbox, a summary that links to each) orBoth. - Console with steps, progress and time left; WPF window (
-Gui, Fluent theme) to type the search, follow it and preview the first messages; daily log; exit codes 0 / 1 / 2. - 30 Pester tests on a simulated Exchange Online tenant; a measurement tool; a user guide and a developer guide in Markdown and self-contained HTML.
Validated on a lab tenant
- Primary mailboxes and archives read through their
MBX:IDs; Recoverable Items; mailboxes without archive, on-premises and not found; periods and subjects; one report per mailbox. - Permissions measured with temporary applications:
Mail.ReadBasic.Allreads every column (archive and Recoverable Items too);settings/exchangeneedsUser.Read.All(403 withUser.ReadBasic.All). - 5,204 messages of one mailbox and its archive in 15 s; a folder of 39,419 meeting messages read in 8 slices, every message once: 43 s without the recipients, 7 min 27 s with them (Exchange reads the recipients of each message: 28.5 s per 1,000 instead of 0.4 s).
Requirements
PowerShell 7.4+ on Windows 10 / 11 or Windows Server 2016 to 2025, Exchange Online, an application registered in Microsoft Entra with Mail.ReadBasic.All and User.Read.All (application permissions, admin consent) and a certificate. Not the auxiliary archives of an auto-expanding archive; settings/exchange is a beta endpoint of Graph.
Unblock the files after downloading: Get-ChildItem "C:\Chemin\Du\Dossier" -Recurse -File -Force | Unblock-File.
Guides: docs\MailboxMessageReport-UserGuide.html and docs\MailboxMessageReport-Guide.html in the zip.