Move-MgUserMessage is a Microsoft Graph PowerShell cmdlet used to move an email message from one Outlook mail folder to another within a user’s mailbox.
It works at the message level and requires the MessageId and the destination folder ID.
Try the M365Corner Microsoft 365 Reporting Tool — your DIY pack with 20+ out-of-the-box M365 reports for Users, Groups, and Teams.
This cmdlet is ideal for automation scenarios such as:
Unlike Outlook rules, this approach is scriptable, auditable, and scalable across users and mailboxes.
Before using this cmdlet, ensure:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Mail.ReadWrite"
You must provide:
Basic syntax:
Move-MgUserMessage -UserId <String> -MessageId <String> -BodyParameter <Hashtable>
The destination folder is passed using the DestinationId key inside the hashtable.
$params = @{
DestinationId = "AQMkAGI2TAAA="
}
Move-MgUserMessage -UserId "user@domain.com" -MessageId "AAMkADhZD3KZAAA=" -BodyParameter $params
$messages = @("AAMkADhZD3KZAAA=", "AAMkADhZD3KZAAQ=")
$destination = @{
DestinationId = "AQMkAGI2TAAA="
}
foreach ($messageId in $messages) {
Move-MgUserMessage -UserId "user@domain.com" -MessageId $messageId -BodyParameter $destination
}
$oldMessages = Get-MgUserMessage -UserId "user@domain.com" -Filter "receivedDateTime lt 2023-01-01"
$destination = @{
DestinationId = "AQMkAGI2TAAA="
}
foreach ($message in $oldMessages) {
Move-MgUserMessage -UserId "user@domain.com" -MessageId $message.Id -BodyParameter $destination
}
$folderMessages = Get-MgUserMessage -UserId "user@domain.com" -MailFolderId "AQMkADhZD3KZAAAA=" -All
$destination = @{
DestinationId = "AQMkAGI2TAAA="
}
foreach ($message in $folderMessages) {
Move-MgUserMessage -UserId "user@domain.com" -MessageId $message.Id -BodyParameter $destination
}
| Feature | Move-MgUserMessage | Copy-MgUserMessage |
| Action | Moves message to another folder | Copies message to another folder |
| Original Message | Removed from source folder | Retained in source folder |
| Typical Use Case | Archiving, cleanup, mailbox reorganization | Compliance, backups, duplication |
| Message Count Impact | Message exists in one folder only | Message exists in multiple folders |
| Permission Required | Mail.ReadWrite | Mail.ReadWrite |
| Automation Scenario | Rule-based inbox management | Auditing or parallel storage |
Quick rule of thumb:
| Key Point | Details |
| Cmdlet Name | Move-MgUserMessage |
| Purpose | Moves email messages between folders in a user mailbox |
| Required Scope | Mail.ReadWrite |
| Target | Outlook mailbox messages |
| Primary Parameters | UserId, MessageId, BodyParameter |
| Automation Benefit | Enables rule-based and bulk mailbox organization |
| Common Use Case | Archiving emails, inbox cleanup, mailbox restructuring |
Did You Know? Managing Microsoft 365 applications is even easier with automation. Try our Graph PowerShell scripts to automate tasks like generating reports, cleaning up inactive Teams, or assigning licenses efficiently.
Ready to get the most out of Microsoft 365 tools? Explore our free Microsoft 365 administration tools to simplify your administrative tasks and boost productivity.
© Your Site Name. All Rights Reserved. Design by HTML Codex