New-MgUserMailFolderChildFolder is a Microsoft Graph PowerShell cmdlet used to create child (sub) mail folders inside an existing Outlook mail folder of a Microsoft 365 user’s mailbox.
It allows administrators and automation scripts to organize mailbox structures programmatically.
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 especially useful for:
It eliminates the need for manual folder creation through Outlook or OWA.
Before using this cmdlet, ensure:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Mail.ReadWrite"
The cmdlet requires:
Basic syntax:
New-MgUserMailFolderChildFolder -UserId <String> -MailFolderId <String> -BodyParameter <Hashtable>
The child folder name must be passed via -BodyParameter.
$params = @{
displayName = "ProjectA"
}
New-MgUserMailFolderChildFolder -UserId "user@domain.com" `
-MailFolderId "AQMkADAwATM3ZmYAZC1lYwEyLTk2MTAtMAAAM_Q5fOAAA=" `
-BodyParameter $params
Loop through folder names and create subfolders one by one.
$folders = @("ProjectB", "ProjectC", "ProjectD")
foreach ($folder in $folders) {
$params = @{
displayName = $folder
}
New-MgUserMailFolderChildFolder -UserId "user@domain.com" `
-MailFolderId "AQMkADAwATM3ZmYAZC1lYwEyLTk2MTAtMDACLTAwCg_Q5fOAAA=" `
-BodyParameter $params
}
This method is ideal for bulk folder creation.
CSV File Structure
FolderName
ProjectE
ProjectF
ProjectG
PowerShell Script
$csv = Import-Csv -Path "C:\path\to\folders.csv"
foreach ($row in $csv) {
$params = @{
displayName = $row.FolderName
}
New-MgUserMailFolderChildFolder -UserId "user@domain.com" `
-MailFolderId "AQMkADAwATM3ZmYAZC1lYwEyLTk2MTAtMDACLTAAAAM_Q5fOAAA=" `
-BodyParameter $params
}
You can pass additional properties like isHidden.
$params = @{
displayName = "Important"
isHidden = $true
}
New-MgUserMailFolderChildFolder -UserId "user@domain.com" `
-MailFolderId "AQMkADAwATM3ZmYAZC1lYwEyLTk2MTAtMDACLsUQAFHkKlAAAM_Q5fOAAA=" `
-BodyParameter $params
| Aspect | New-MgUserMailFolderChildFolder | New-MgUserMailFolder |
| Folder Level | Child (sub) folder | Root-level mail folder |
| Requires Parent Folder ID | ✅ Yes | ❌ No |
| Typical Usage | Creating subfolders like Projects, Years | Creating top-level folders |
| Automation Scenario | Structured mailbox hierarchy | Initial mailbox setup |
| Scope | User mailbox | User mailbox |
In short:
| Key Point | Details |
| Cmdlet Name | New-MgUserMailFolderChildFolder |
| Purpose | Creates subfolders inside an existing Outlook mail folder |
| Required Scope | Mail.ReadWrite |
| Target | User mailbox folders |
| Key Parameters | UserId, MailFolderId, BodyParameter |
| Automation Benefit | Enables scripted and bulk mailbox folder creation |
| Common Use Case | Mailbox organization, migrations, folder standardization |
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