One of the tasks I often get when setting up new Office 365 tenant or installing Exchange Servers is to change the visibility of Room Mailboxes or in some cases even standard users. There's nothing hard about it, and there are plenty of articles about it. It's just three simple steps.
You just need to change Folder Permissions to Limited Details on Room:\Calendar using code below
Set-MailboxFolderPermission -AccessRights LimitedDetails -Identity Room:\calendar -User default
And if it's needed change how calendar processing is done on those Room Mailboxes. Depending on business requirements management may want to add an organizer to subject.
Set-CalendarProcessing -Identity Room -AddOrganizerToSubject $true -DeleteComments $false -DeleteSubject $false
By default, the subject is deleted, so depending on your requirement you need to set it to true or false. If you set your DeleteSubject to false only new meeting requests will be affected. For existing meetings you will see the organizer and the location, new calendar entries will also have the subject displayed.
It wasn't that bad, right? And it's well-known knowledge that you can get when you ask Google for that. What I wanted to mention in this article is that depending on the language set on user mailbox setting LimitedDetails access right will most likely fail if it's anything then English. In my case, it's almost never English. So what do you do? Simple you use the language you expect on the mailbox!
Set-MailboxFolderPermission -AccessRights LimitedDetails -Identity Room:\Kalendarz -User default
See? Simple! Well not really. There are lots of languages out there and knowing which user, which mailbox has what language is hard to guess. Fortunately, there's a way to ask mailbox to give us that information so we don't have to guess and have a fully automated way to do that.
$Mailboxes = Get-Mailbox -RecipientTypeDetails RoomMailbox $Count = 0 foreach ($Mailbox in $Mailboxes) { $Count++ $Folder = Get-MailboxFolderStatistics -Identity $($Mailbox.UserPrincipalName) -FolderScope Calendar #-ErrorAction Stop Write-Color "[", $Count, '/', $Mailboxes.Count, '] ', "Processing ", $Mailbox.UserPrincipalName -Color Yellow, White, Yellow, White, Yellow, White, Green foreach ($F in $Folder) { if ($F.FolderType -eq 'Calendar') { $CalendarPath = $F.FolderPath -Replace '/', '\' Set-MailboxFolderPermission -Identity "$($Mailbox.UserPrincipalName):$CalendarPath" -User Default -AccessRights LimitedDetails -ErrorAction SilentlyContinue -WhatIf Set-CalendarProcessing -Identity $Mailbox.UserPrincipalName -AddOrganizerToSubject $true -DeleteComments $false -DeleteSubject $false -ErrorAction SilentlyContinue -WhatIf Write-Color -Text "[", $Count, '/', $Mailboxes.Count, '] ', "Processed ", $Mailbox.UserPrincipalName, ' on folder type ', $F.FolderType, ' path ', $CalendarPath ` -Color Yellow, White, Yellow, White, Yellow, White, Yellow, White, Green } } }
As you can see above, I'm merely getting all mailboxes and then for each mailbox I'm executing Get-MailboxFolderStatistics which happens to have FolderType available for each entry. This is always stored in English. So we use foreach to check for Calendar entry and use that folder as CalendarPath. Remember to change RecipientTypeDetails to any other type you may want to adjust settings for. Also, keep in mind that Set-CalendarProcessing may not be required in your scenario. You can apply the same approach to any other folder type to cover other needs. As you can see on the screenshot below folder names are in Swedish but FolderType stays in English. That way it's easy to apply that knowledge to other scenarios you may have.
Get-MailboxFolderStatistics -Identity $($Mailbox.UserPrincipalName) | Format-Table -AutoSize Name, FolderPath, FolderType, CreationTime, Date, LastModifiedTime
Keep in mind that the code above that fixes Calendar entries has FolderScope defined as Calendar. This means that only Calendar is returned. If you want to get all of it, simply skip that and you should be able to apply your changes to any type of folder you need.