Organizing mailbox folders is essential for maintaining a clutter-free email experience—especially in large enterprises where communication is nonstop. Whether you're onboarding users, preparing shared mailbox structures, or building automated routines, the New-MgUserMailFolder cmdlet can be your best friend.
This blog will show you how to use New-MgUserMailFolder to create mail folders in a Microsoft 365 user's mailbox using PowerShell and Microsoft Graph.
New-MgUserMailFolder is a Microsoft Graph PowerShell cmdlet that allows administrators to create new mail folders in a user's mailbox.
You can create folders in the root of the mailbox or nest them inside existing folders. It’s especially useful when setting up folder structures programmatically for multiple users.
Here’s why this cmdlet is a game-changer for admins:
New-MgUserMailFolder -UserId <String> -BodyParameter <Hashtable>
Parameters:
$params = @{
displayName = "Project Documents"
}
New-MgUserMailFolder -UserId "user@domain.com" -BodyParameter $params
This creates a basic plain-text message. You can send it using Send-MgUserMessage.
$params = @{
displayName = "Invoices"
parentFolderId = "AQMkAGI2TAAA="
}
New-MgUserMailFolder -UserId "user@domain.com" -BodyParameter $params
This creates a folder named "Invoices" nested inside an existing folder with ID AQMkAGI2TAAA=.
$folders = @("HR", "Finance", "IT")
foreach ($folder in $folders) {
$params = @{
displayName = $folder
}
New-MgUserMailFolder -UserId "user@domain.com" -BodyParameter $params
}
Perfect for setting up default folders for new users or departmental mailboxes.
FolderName,ParentFolderId
Team Meetings,AQMkAGI2TAAA=
Finance,BQMkBGI3TBBB=
IT,CQNkCGI4TCCC=
$csvPath = "C:\Path\To\Folders.csv"
$folders = Import-Csv -Path $csvPath
foreach ($folder in $folders) {
$params = @{
displayName = $folder.FolderName
parentFolderId = $folder.ParentFolderId
}
New-MgUserMailFolder -UserId "user@domain.com" -BodyParameter $params
}
This lets you bulk-create folders using a simple spreadsheet—ideal for large-scale mailbox setups.
Get-MgUserMailFolder -UserId "user@domain.com" | Out-GridView
Use this to visually inspect the newly created folders and confirm their structure.
The New-MgUserMailFolder cmdlet gives administrators a simple, scalable way to create and manage folders inside Microsoft 365 mailboxes. From one-off folder creation to bulk scripts using CSVs, it's a tool that belongs in every PowerShell-savvy admin's toolkit.
Take it a step further by combining it with other cmdlets for a truly automated email management solution.
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