How to change calendar permissions for O365 via Powershell

This is something I had to do recently. Powershell makes life far easier to manage pretty much anything with O365 but with Powershell, you can change permissions more efficiently.

As always with Powershell and Office 365, we need to connect it to our tenant. To do this please use this guide here.

Checking Permissions


To see the current permissions setup using the following:

Get-MailboxFolderPermission -Identity [email protected]:\calendar

The above command will list all permissions under 1 mailbox. You will need to change the USERID command.
To list all of the permissions for each calendar, you can use the following command:

Get-Mailbox | ForEach-Object {Get-MailboxFolderPermission $”:\calendar”} | Where {$.User -like “Default”} | Select Identity, User, AccessRights

Now, before we get onto the next section; you should probably take a look at the type of permissions we can change. Here are the permissions and what they mean:

  • Owner — gives full control of the mailbox folder: read, create, modify and delete all items and folders. Also this role allows to manage items permissions;

  • PublishingEditor — read, create, modify and delete items/subfolders (all permissions except the right to change permissions);

  • Editor — read, create, modify and delete items (can’t create subfolders);

  • PublishingAuthor — create, read all items/subfolders. You can modify and delete only items you create;

  • Author — create and read items; edit and delete own items;

  • NonEditingAuthor – full read access and create items. You can delete only your own items;

  • Reviewer — read folder items only;

  • Contributor — create items and folders (can’t read items);

  • AvailabilityOnly — read Free/Busy info from the calendar;

  • LimitedDetails;

  • None — no permissions to access folder and files.

Granting permissions

If you would like to grant USER A access to USER B, you can use the following command:

Add-MailboxFolderPermission -Identity [email protected]:\calendar -user [email protected] -AccessRights Editor

Remember you can change the -AccessRights Editor to -AccessRights Reviewer or -AccessRights LimitedDetails

Another great tip is that you can use Powershell to change the default permissions for 1 calendar. If you want everyone in the tenant to have Reviewer access, you can run the following:

Set-MailboxFolderPermission -Identity [email protected]:\calendar -User Default -AccessRights Reviewer

If you want to make tons of changes and add multiple permissions to multiple users you can create a .CSV with the UserIDs and then import them. To do this, you will need to change folder directory on Powershell until you get to your users.csv. Then, run:

Import-Csv users.csv | foreach { add-MailboxFolderPermission -Identity "[email protected]:\calendar" -User $_.alias -AccessRights Owner }

Removing permissions

You can remove permissions fairly easy. Opposite to the first command, you can remove test1 from test2 by using the command:

Remove-MailboxFolderPermission -Identity [email protected]:\calendar –user [email protected]

If a calendar has many permissions added and you want to remove them all and start from scratch, you can run the following which will reset them to default:

Get-MailboxFolderPermission USERID:\Calendar | % { Remove-MailboxFolderPermission -Identity $.Identity -User $.User }

As always with tenants, no two are exactly the same. You may need to modify the Powershell scripts above to fit your own environment better. Powershell will be able to resolve any permission query and will do it 10x quicker than manually going through the portal but you need to know the commands or be able to find them easily.

Previous
Previous

Turn off App Passwords/Enable Modern Auth via Powershell

Next
Next

How to connect to your Office 365 Tenant via Powershell