Our thinking


Set default calendar sharing permissions on all user calendars in Office 365

It’s often handy to have all users in a Office 365 tenancy to be able to view all details in everyone else’s calendars. While each user can set these permissions on their individual calendar, it’s often quicker and easier to set them on all mailboxes via PowerShell.

First connect to MS365 via PowerShell. On macOS, it’s done like this (note that this doesn’t support modern authentication)

$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Import-PSSession $Session

On Windows, it’s easier with Connect-ExchangeOnline with the Exchange Online PowerShell V2 module (which does support modern auth)

https://docs.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps

Once connected to Office 365 / ExO, then use the following script:

$Users = Get-Mailbox -Resultsize Unlimited

ForEach ($User in $Users) {
Write-Host "Setting Permission for $($User.Alias)..."
Set-MailboxFolderPermission -Identity $($User.Alias):\Calendar -User Default -AccessRights Reviewer
}

This will loop through all mailboxes in your tenancy and set the default sharing permissions to Reviewer on everyone’s calendar.

3 thoughts on “Set default calendar sharing permissions on all user calendars in Office 365

  1. This isn’t working as it should. A quick fix is instead:
    ForEach ($User in $Users) {
    $Alias=$($User.Alias)
    Write-Host “Setting Permission for $Alias…”
    Set-MailboxFolderPermission -Identity $Alias”:\Calendar” -User Default -AccessRights Reviewer
    }

  2. In case you had multiple domains and the alias was not unique, I used the UPN which got all my accounts.

    ForEach ($User in $Users) {
    $Alias=$($User.UserPrincipalName)
    Write-Host “Setting Permission for $Alias…”
    Set-MailboxFolderPermission -Identity $Alias”:\Calendar” -User Default -AccessRights Reviewer
    }

Leave a Reply