New-MgmtGraphUserMailFolderChildFolder
MgmtGraph: Provisions a new child mail folder
#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.Mail
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true, Position = 0)]
[string]$Identity,
[Parameter(Mandatory = $true)]
[string]$MailFolderId,
[Parameter(Mandatory = $true)]
[string]$DisplayName,
[switch]$Hidden
)
Process {
try {
$params = @{
'UserId' = $Identity
'MailFolderId' = $MailFolderId
'DisplayName' = $DisplayName
'Confirm' = $false
'ErrorAction' = 'Stop'
}
if ($Hidden) { $params.Add('IsHidden', $true) }
$folder = New-MgUserMailFolderChildFolder @params
$result = [PSCustomObject]@{
UserId = $Identity
ParentId = $MailFolderId
DisplayName = $DisplayName
Id = $folder.Id
Status = "ChildFolderCreated"
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
}
Write-Output $result
}
catch {
throw
}
}Specifies the UserPrincipalName or ID of the user.
Specifies the ID of the parent mail folder.
Specifies the display name for the new child folder.
Off
Optional. If set to $true, the child folder will be hidden from the user interface.