How-To: Add Calendar Permissions via PowerShell
Microsoft 365, Exchange Online
Table of Contents
Introduction
Calendar permissions are generally managed by the end user on their own calendar, however for Shared mailboxes, shared calendars, or for bulk addition of new calendar access powershell will provide the fastest and only admin interface to perform these actions for users.
Requirements
You will need to be able to run the Exchange Online powershell module, please see Command Line Administration: How to Setup PowerShell Tools - ALPHA for details on setup and configuration of PowerShell.
Connect-ExchangeOnline
When prompted logon with a Global Admin identity for the customer.
Step-by-Step Instructions (Shared Calendar Default)
Step 1: Set an environment variable for the mailbox name
- Set the mailbox name in a variable to use with the next script, use the email address or UPN
$sharedmailbox = “user@company.com”
Step 2: Run the following command
Set-MailboxFolderPermission -Identity ($sharedmailbox + “:\Calendar") -User Default -AccessRights ”LimitedDetails"
Step-by-Step Instructions (from a group to a group)
Step 1: Create/update a list of users
- Create a list of users in a simple PowerShell array format
$userlist = ‘user1@customer.com’,'user2@customer.com','user3@customer.com"
- Could also create this from existing users, for example if all users were in a distribution list you could:
$Userlist = Get-DistributionGroupMembers -identity “groupname” | Select Name
Step 2: Run the following script
foreach ($user in $userlist) {foreach ($perm in $userlist) {IF($perm -ne $user) {Add-MailboxFolderPermission -identity ($user + “:\Calendar”) -User $perm -AccessRights “LimitedDetails”}}}
Tips and Best Practices
- If the Add verb for mailbox folder permissions fails and states that the user already has permissions, then you will want to view the permissions to see if they are equal or better than being added.
Get-MailboxFolderPermissions -identity ($user + “:\Calendar”)
Additional Resources
Provide links or references to additional materials: