When an item is moved from one folder to another in Exchange Online, the mailbox audit log typically records an operation called UpdateFolder. (Note that moves to the Deleted Items folder may be recorded as MoveToDeletedItems; be sure you know which move events you’re interested in.) You can use the built‐in cmdlet Search-MailboxAuditLog to return all events of this type for a given mailbox over a specified date range.
Below is an example that you can customize as needed. In this example, we search mailbox audit logs for the user "user@example.com" between October 1, 2023, and October 31, 2023 and filter for events where the operation is UpdateFolder (i.e. a folder change that occurs when an item is moved):
# Define parameters (adjust dates and mailbox identity as needed)
$mailbox = "user@example.com"
$startDate = "10/01/2023"
$endDate = "10/31/2023"
# Run the audit log search
Search-MailboxAuditLog -Mailboxes $mailbox -StartDate $startDate -EndDate $endDate -Operation UpdateFolder -ShowDetails |
Select-Object LogonUserDisplayName, Operation, Folder, ItemSubject, LogonType, LastAccessed, { $_.AuditData } |
Format-List
Explanation
- Search-MailboxAuditLog: This is the cmdlet used to retrieve mailbox audit events.
- -Mailboxes: Specifies the mailbox you want to audit.
- -StartDate and -EndDate: Define the time window for your search.
- -Operation UpdateFolder: Filters for events where the user changed the folder on an item (which includes moving it).
- -ShowDetails: Returns additional property details where you might see the source and destination folder information (usually contained within the AuditData field).
If you also want to capture moves to the Deleted Items folder (which are sometimes logged as MoveToDeletedItems), you can run a similar query or extend the filtering logic. For example:
# Get both UpdateFolder and MoveToDeletedItems operations
$auditEvents = Search-MailboxAuditLog -Mailboxes $mailbox -StartDate $startDate -EndDate $endDate -ShowDetails
# Filter for both types of move events
$movedItems = $auditEvents | Where-Object { $_.Operation -eq "UpdateFolder" -or $_.Operation -eq "MoveToDeletedItems" }
$movedItems | Select-Object LogonUserDisplayName, Operation, Folder, ItemSubject, LogonType, LastAccessed, { $_.AuditData } |
Format-List
What to Look For
In the AuditData field (which is a JSON-formatted string), you may find further details about the move—such as the source and destination folders. If you need to parse those details further, you can convert the JSON string to a PowerShell object. For example:
$movedItems | ForEach-Object {
$details = $_.AuditData | ConvertFrom-Json
[PSCustomObject]@{
LogonUser = $_.LogonUserDisplayName
Operation = $_.Operation
SourceFolder = $details.SourceFolder
DestinationFolder= $details.DestinationFolder
ItemSubject = $_.ItemSubject
Date = $_.LastAccessed
}
} | Format-Table -AutoSize
This script will help you audit mailbox moves by showing who moved the item, when it was moved, and (if available) from which folder to which folder.
Keep in mind that mailbox audit logging must be enabled on the mailbox and that it can take some time for Exchange Online to log all the necessary details. Adjust the parameters to suit your environment and auditing needs.