I tried to write a below code to check outlook calendar permission:
$Usermailbox = Read-Host "Please enter the mailbox whose permissions you want to see"
Get-MailboxFolderPermission -Identity "$Usermailbox :\calendar"
But when I tried to do that I got an error
Get-MailboxFolderPermission: xxxx|Microsoft.Exchange.Configuration.Tasks.ManagementObjectNotFoundExceptio
n|The specified mailbox Identity:“xxx ” doesn’t exist.
I know this is caused because the code sees $Usermailbox :\calendar as one string probably
How to separate those?
CodePudding user response:
You should not have a space in the between the mailbox and folder name. Since :
is a valid variable name character, use $()
to express the variable separately:
Get-MailboxFolderPermission -Identity "$($Usermailbox):\calendar"