Поделиться через


Office 365: Finding the name of the Calendar folder

When setting permissions on your users’ Calendar folders to allow (or disallow) them to view each others Free/Busy status, you may encounter the problem that a user has localized the folder names and you don’t know what the name of the folder is in his/her language. Even worse; you’re doing this in a script, that’s just using the “username:\Calendar” label.

The solution here is to not use hard coded names but instead detect the name of the folder and use in in your script (or command line). To make that really simple, you can use this bit of PowerShell code:

  1. $path = $user.Identity + ":\" + (Get-MailboxFolderStatistics $user.Identity | Where-Object { $_.Foldertype -eq "Calendar" } | Select-Object -First 1).Name
  2. Set-MailboxFolderPermission -Identity $path -User Default -AccessRights LimitedDetails

The first line will search the MailboxFolderStatistics for folders of the type “Calendar” and return the first match.

Second line will use the variable $path to set AccessRights on the folder regardless of localization.

The $user variable could have been populated with Get-User or an input file.

Enjoy! :)