Blog/ Outlook how-tos

How to Search the Mailbox Audit Log in Microsoft 365

Nafiul HasanNafiul Hasan· 10 min read
Illustration of a mailbox audit log search in Microsoft 365, showing a magnifying glass over a list of message activity records

The short answer

Search-MailboxAuditLog and New-MailboxAuditLogSearch are retired from Exchange Online, so use Search-UnifiedAuditLog or the Microsoft Purview portal. In Purview, open Audit, set dates, activities and users, then run the search. For activity inside a shared mailbox, use Search-UnifiedAuditLog with -FreeText. Standard licenses keep records 180 days; E5 keeps Exchange records a year.

Search-MailboxAuditLog is retired. How to search the Microsoft 365 mailbox audit log in Purview or with Search-UnifiedAuditLog, plus retention limits.

On this page
  1. 01Is Search-MailboxAuditLog deprecated? What replaces it
  2. 02Before you start
  3. 03How to search the mailbox audit log in the Purview portal
  4. 04Which audit operations to search (FolderBind, MailItemsAccessed, SoftDelete)
  5. 05Audit (Standard) vs. Audit (Premium) retention
  6. 06What to do when the search doesn't work
  7. 07What about your own AI agent's actions?

To search the mailbox audit log in Microsoft 365, open the Microsoft Purview portal, choose Audit, set a date range, activities and users, and run the search. Search-MailboxAuditLog no longer exists in Exchange Online: Microsoft confirmed in February 2026 that it and New-MailboxAuditLogSearch are fully retired, replaced by Search-UnifiedAuditLog.

Mailbox audit logging has been on by default across Office 365 and Microsoft 365 since January 2019, so the records usually already exist. What trips people up is scope: the Users field and -UserIds show what a person did, not everything that happened in a mailbox. That difference decides whether a shared mailbox search comes back empty.

Quick path

Purview portal > Audit > Search > set dates, activities and users > Search > Export. For a shared mailbox, use the PowerShell command in the next section.

Is Search-MailboxAuditLog deprecated? What replaces it#

Yes, and in Exchange Online it's gone. Microsoft's retirement notice, updated February 18, 2026, says both cmdlets "have been fully retired and removed from Exchange Online" and that all audit log searches must now use Search-UnifiedAuditLog.

The cmdlets' Microsoft Learn pages still read "will be deprecated", so go by the notice. Those pages also list the cmdlets for on-premises Exchange Server, where this retirement doesn't apply. Here is how an old script maps across:

Old cmdlet or parameterReplacement
Search-MailboxAuditLogSearch-UnifiedAuditLog in Exchange Online PowerShell
New-MailboxAuditLogSearchA search job on the Purview Audit Search page, then Export
-Identity <mailbox>-FreeText (Get-Mailbox <mailbox>).ExchangeGuid
-Mailboxes a,bOne -FreeText search per mailbox
-LogonTypesNo matching parameter. Read LogonType in each record's AuditData
-ShowDetailsAuditData comes back by default. Add -Formatted to make it easier to read
-Operations-Operations
-ResultSize up to 250,000-ResultSize up to 5,000, or -SessionCommand ReturnLargeSet with a -SessionId for up to 50,000 by paging
Who deleted mail in a shared mailbox
CmdletSearch-UnifiedAuditLog
Window-StartDate 10/01/2026 -EndDate 11/01/2026
Mailbox-FreeText (Get-Mailbox [email protected]).ExchangeGuid
Filter-Operations SoftDelete,HardDelete,MoveToDeletedItems
Size-ResultSize 5000

Don't filter on -RecordType ExchangeItem alone

It's a common migration tip, but Microsoft's schema puts single-item actions in ExchangeItem, multi-item moves and deletes in ExchangeItemGroup, and MailItemsAccessed in ExchangeItemAggregated. Filter with -Operations instead, as Microsoft's own examples do. Dates without a time zone are read as UTC.

Before you start#

Confirm that auditing is active and which sign-in type you're investigating. Microsoft audits a different set of actions by default for owners, delegates and admins.

  • Confirm the org-wide setting. Run Get-OrganizationConfig | Format-List AuditDisabled in Exchange Online PowerShell. False means mailbox auditing on by default is active, and that overrides whether auditing is enabled on individual mailboxes.
  • Get the right role. Searching needs the Audit Logs or View-Only Audit Logs role in the Microsoft Purview portal, which the Audit Manager and Audit Reader role groups include. Running the cmdlet needs the same role in the Exchange admin center. A mailbox owner without one of these roles has to ask an admin.
  • Check the mailbox type. User, shared and Microsoft 365 Group mailboxes support auditing on by default, though Group mailboxes log a smaller fixed set. Resource and public folder mailboxes aren't supported.
Sign-in typeWho it coversMain actions logged by default
OwnerThe account associated with the mailboxSend, SoftDelete, HardDelete, MoveToDeletedItems, Update, Create, UpdateInboxRules, UpdateFolderPermissions, UpdateCalendarDelegation, MailItemsAccessed
DelegateA user with SendAs, SendOnBehalf or FullAccess permission, including an admin with FullAccessSendAs, SendOnBehalf, SoftDelete, HardDelete, MoveToDeletedItems, Update, Create, UpdateInboxRules, UpdateFolderPermissions, MailItemsAccessed. Not FolderBind
AdmineDiscovery searches, MAPI Editor access, or an account impersonating another userThe delegate set plus Send and UpdateCalendarDelegation. Not FolderBind

Opening a mailbox isn't audited by default

FolderBind fires when a delegate or admin opens a folder or the mailbox, but it's off by default. To add it, run Set-Mailbox -Identity <mailbox> -AuditDelegate @{Add="FolderBind"}, and the same with -AuditAdmin. It only logs from that point forward, delegate records are consolidated to one per folder in a 24-hour period, and customizing a sign-in type means new Microsoft default actions are no longer added to it automatically.

How to search the mailbox audit log in the Purview portal#

The portal is the fastest path for a one-off look at what a named person did. For everything that happened inside one mailbox, use the -FreeText command above.

  1. 1

    Open Audit in the Purview portal

    Sign in to the Microsoft Purview portal and select the Audit solution card. If it isn't showing, select View all solutions, then Audit under Core, and stay on the Search page.

  2. 2

    Set the date range

    Pick a start and end date and time, shown in UTC. The default is the last seven days, and one search can't span more than 180 days.

  3. 3

    Choose the activities

    In Activities - friendly names, pick entries such as Deleted messages from Deleted Items folder or Accessed mailbox items. Or type exact names in Activities - operations names, such as SoftDelete,HardDelete,MoveToDeletedItems. A misspelled operation name returns nothing.

  4. 4

    Name the users

    Add the people whose actions you want in Users. Leave it blank to include everyone, though broad searches in large tenants can take up to 48 hours, then filter the finished results.

  5. 5

    Run it and wait for the job

    Select Search. The job keeps running if you close the browser and moves through Queued, In Progress and Completed, and you can run up to 10 at once. Exchange records typically appear 60 to 90 minutes after the activity, but Microsoft doesn't commit to a fixed delay.

  6. 6

    Read or export the results

    Open the completed job to see the date, IP address, user and activity for each record, and select one for full details. Use Export for a CSV of up to 50,000 rows on Audit (Standard) or 1,000,000 on Audit (Premium). Completed jobs are kept for 30 days.

The Users field won't show activity inside a shared mailbox

Microsoft says the Users field and -UserIds find what a named person did, and don't return activity performed in a shared mailbox, or by a delegate in someone else's mailbox. Use -FreeText with the mailbox's ExchangeGuid, as in the example above. Microsoft's shared mailbox guide also shows -FreeText with the mailbox address. Use -UserIds with a delegate's address to see what that delegate did.

Once a search job finishes, the result reads like a timeline: who, what action, and exactly when. To check who has access, run Get-MailboxPermission <mailbox>, and see Full Access vs Send As vs Send on Behalf for what each one allows. If the message never arrived at all, you want a message trace in Microsoft 365 instead.

A magnifying glass held over a stack of message records, representing an audit log search that surfaces who accessed, moved, or deleted an email in a mailbox
One completed search job returns every matching audit record inside your chosen date window.

Which audit operations to search (FolderBind, MailItemsAccessed, SoftDelete)#

These are the operation names that answer most mailbox questions. Copy them exactly, because the search matches on the precise name.

OperationWhat it logs
SoftDeleteA message deleted from Deleted Items or permanently deleted with Shift+Delete, moved to Recoverable Items
HardDeleteA message purged from the Recoverable Items folder
MoveToDeletedItemsA message moved to the Deleted Items folder
SendAsA message sent as though it came from the mailbox owner
SendOnBehalfA message sent on the owner's behalf, showing recipients who actually sent it
UpdateInboxRulesAn inbox rule added, changed or removed in the Outlook desktop client. New-InboxRule and Set-InboxRule cover Outlook on the web
FolderBindA folder or the mailbox opened by a delegate or admin. Off by default
MailItemsAccessedMail accessed through any protocol or client. MailAccessType Bind means one message; Sync means Outlook desktop downloaded a folder

MailItemsAccessed licensing depends on which page you read

Microsoft's main article says MailItemsAccessed is on by default for Office 365 and Microsoft 365 E3 and E5 users, while its shared mailbox guide says E5 is required. To see what a mailbox actually audits, run Get-Mailbox <mailbox> | Select-Object -ExpandProperty AuditOwner, and the same with AuditDelegate and AuditAdmin.

Audit (Standard) vs. Audit (Premium) retention#

How far back you can search depends on licensing, and it's the most common reason a real investigation comes up empty: the record existed, but it aged out first.

Audit (Standard)Audit (Premium)
RequiresMost Microsoft 365 and Office 365 enterprise plansAn Office 365 or Microsoft 365 E5 license, Microsoft Purview Suite, or the E5 eDiscovery and Audit add-on
Default retention180 days. Records generated before October 17, 2023 were kept 90 days1 year for Exchange, SharePoint, OneDrive and Microsoft Entra records; 180 days for the rest
Custom retentionNot availablePolicies from 7 days to 1 year. 3, 5, 7 and 10 years need the 10-Year Audit Log Retention add-on
Search export limitUp to 50,000 rowsUp to 1,000,000 rows

Retention follows whoever did the action

The license that counts belongs to the user who generated the record, not the mailbox that was acted on. A shared mailbox with no license of its own still gets records, kept for the retention of the delegate or admin who acted, so two delegates can leave records with different lifetimes on the same day.

What to do when the search doesn't work#

  • No results at all. Run Get-AdminAuditLogConfig | Format-List UnifiedAuditLogIngestionEnabled in Exchange Online PowerShell. If it's False, audit log search is off for the tenant. Don't check this in Security & Compliance PowerShell, where the value always shows False.
  • Nothing for a shared mailbox. You probably searched by the mailbox address in Users or -UserIds. Use -FreeText instead. If that's also empty, run Get-Mailbox <mailbox> | Select AuditEnabled,AuditOwner,AuditDelegate,AuditAdmin, because one of Microsoft's guides warns shared mailbox auditing might not be enabled by default.
  • Events missing for users without E5. Microsoft says mailbox audit events can fail to appear for non-E5 users even with auditing on by default. Its workaround is Set-Mailbox -Identity <mailbox> -AuditEnabled $true, and if the value is already True, set it to $false and back to $true.
  • The activity isn't in the default set. FolderBind has to be added to AuditDelegate or AuditAdmin first, and it can't reach back to events from before you added it.
  • "The selected date range is greater than 180 days." One search job is capped at 180 days. If you use the full range, Microsoft says to select the current time for the start date, or you'll get a start date error.
  • The record isn't there yet. Exchange records typically surface within 60 to 90 minutes, with no guaranteed delay. For a live incident, run the search again later before you conclude that nothing was logged.

What about your own AI agent's actions?#

We build AI Emaily, an AI email client, and its audit log covers only what its own agent did, so it's no substitute for Purview when a colleague or admin touched a mailbox. If that narrower question is yours, see how undo and audit work for AI email actions.

Frequently asked

Nafiul Hasan

Written by

Nafiul Hasan

Nafiul Hasan is an entrepreneur and AI automation system builder with 10+ years of experience turning messy, manual workflows into reliable automated systems. He designs and ships AI enterprise solutions end-to-end — the agent logic, the data plumbing, and the product people actually use — and founded AI Emaily to give busy professionals their attention back. He writes here from the builder's seat: what works, what breaks, and how to put AI to work without giving up control.

EntrepreneurAI Automation System BuilderAI EnthusiastBuilds AI Enterprise Solutions10+ years experience
More from Nafiul
Ready when you are

Need an audit trail for your AI email agent?

AI Emaily logs every action its own agent takes. It doesn't replace Microsoft Purview. 7-day free trial on Pro or Autopilot.

  • 7-day free trial
  • Cancel anytime
  • Every provider