How to Add Calendar Permissions in Office 365/Exchange via PowerShell?

This is a tutorial on how to view, add and remove mailbox calendar permissions on Microsoft 365 (ex-Office-365) and on-premises Exchange Server via PowerShell. For example, you need to grant read permissions to the room mailbox calendar for a few users. You can grant room mailboxes calendar permissions for specific users or an AD group. With this approach, you only need to grant access to the mailbox calendar to a specific group of users once. After that, to grant access to the calendar to a new user you should simply add a user to the Active Directory group (without changing mailbox calendar permissions via PowerShell).

Users can independently grant the necessary permissions for Outlook mailbox folders and items to other users (from the Outlook/OWA interface). Unfortunately, in Exchange 2019/2016/2013 and Exchange Online (Office 365), the administrator cannot centrally manage calendar permissions from the GUI (Exchange MMC, EAC — Exchange Administration Center, or Microsoft 365 admin portal). However, you can use a built-in Add-MailboxFolderPermission cmdlet, which allows managing user permissions on any user’s mailbox folder from PowerShell. You can use this cmdlet to manage calendar permissions in on-premises Exchange Server organizations and Microsoft 365 tenants.

Connecting Microsoft 365 or Exchange Server from PowerShell

First, you need to connect to your Microsoft 365 or on-premises Exchange tenant.

Connecting to Microsoft 365 (Exchange Online) tenant with PowerShell:

  1. Open the Windows PowerShell console;
  2. Check if the Exchange Online PowerShell V2 (EXO V2) is installed on the computer:
    Get-InstalledModule ExchangeOnlineManagement

    If the module is missing, you can install it from the PowerShell Online Gallery using the following command:

    Install-Module PowershellGet

    office 365 calendar permissions powershell

  3. Run the following command to connect to your Exchange Online tenant:
    Connect-ExchangeOnline -UserPrincipalName kirill@theitbros.onmicrosoft.com -ShowProgress $true

    calendar permissions powershell

By default, Microsoft Modern Authentication is used to sign in. Specify your Microsoft 365 tenant admin credentials. If you have MFA (Multi-Factor Authentication) enabled for your Azure account, you must confirm your account login with your second factor.

ADVERTISEMENT

Connecting to On-prem Exchange Server with PowerShell:

You can remotely connect to your on-prem Exchange Server 2010, 2013, 2016, and 2019 using PowerShell (you do not need to install the Exchange Management Shell on your computer):

  1. Save your Exchange administrator’s credentials into the PowerShell variable:
    $LiveCred = Get-Credential
  2. Establish a remote PowerShell session with your Exchange CAS server over HTTPS using the Kerberos authentication (replace ny-msg-02 with the FQDN of your on-prem Exchange Server):
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://ny-msg-02/powershell/ -Credential $LiveCred -Authentication Kerberos
  3. Allow running digitally signed scripts by setting the PowerShell Execution Policy value to RemoteSigned:
    Set-ExecutionPolicy RemoteSigned
  4. The next step is to import Exchange management commands from a remote Exchange Server host to your PowerShell console:
    Import-PSSession $Session -DisableNameChecking

    powershell calendar permissions
    set calendar permissions powershell

Hint. If you logged in directly to the on-premises Exchange server, you can either start the Exchange Management Shell right away, or run a regular PowerShell.exe CLI, and load Exchange cmdlets with the command:

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn

You can use the following basic PowerShell cmdlets to manage calendar permissions in Exchange or Microsoft 365:

  • Add-MailboxFolderPermission;
  • Set-MailboxFolderPermission;
  • Get-MailboxCalendarFolder;
  • Remove-MailboxFolderPermission;
  • Get-MailboxFolderPermission.

How to Get Mailbox Calendar Permissions Using PowerShell?

You can view current calendar (folder-level) permissions of the specified mailbox by using the Get-MailboxFolderPermission cmdlet (change the username to the user account you want to check calendar permissions for):

Get-MailboxFolderPermission cyril@theitbros.onmicrosoft.com:\calendar

add calendar permissions powershell
FolderName User AccessRights SharingPermissionFlags
———- —- ———— ———————-
Calendar Default {AvailabilityOnly}
Calendar Anonymous {None}
Calendar Alex {Reviewer}
Calendar Henrietta {Editor}

Note. If this command returns that ‘username:\calendar’ cannot be found, most likely the user has Outlook language settings other than English. Appropriately, the Calendar folder name can be different (calendar\kalender\calendario\calendrier\календарь). For example, to view calendar permissions for the Dutch Language (nl-NL) use the command:

Get-MailboxFolderPermission username:Agenda

You can get the name of the calendar in the current user’s regional configuration with the command:

(Get-MailboxFolderStatistics username -FolderScope Calendar).Identity

calendar permissions office 365 powershell

As you can see, the default AvailabilityOnly role is assigned on a calendar folder only.

exchange online calendar permissions

Note. By default, in Exchange Server organization and Microsoft 365 (Exchange Online) tenant users can’t view Outlook e-mails or calendar items of other users. The only permission that is provided to all users by default is the ability to view the Free/Busy information in other users’ calendars (this is the AvailabilityOnly role).

You can get the list of all mailbox calendars permissions in your organization using the following command:

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

Tip. In on-premise Exchange, you can view a user’s calendar settings in a specific mailbox database using the following command (Change mbxdbname to the name of your Exchange mailbox database):

Get-Mailbox –database mbxdbname | ForEach-Object {get-MailboxFolderPermission $_”:\calendar”}

Using PowerShell, you can find all the calendars in your organization/tenant that a particular user has been granted access to. In this example, we want to display a list of user mailboxes whose calendars are allowed to be accessed by a user named Muller:

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

add calendar permissions powershell

ADVERTISEMENT

The list of users whose calendars the user can access are listed in the Identity column. The AccessRights field specifies the current calendar permissions.

Tip. You can use the Get-EXOMailboxFolderPermission cmdlet instead of Get-MailboxFolderPermission to view the permissions of mailbox items in the Exchange Online PowerShell V2 module.

Outlook Calendar Roles and Permissions

When managing calendar and Outlook folder permissions, you can use the following predefined permissions level roles:

  • Owner — gives full control of the mailbox folder: read, create, modify, and delete all items and folders. Also, this role allows to manage item’s 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, and 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 — view availability data with calendar item subject and location;
  • None — no permissions to access folders and files.

set calendar permissions powershell office 365

You can also use granular permissions to fine-tune the access rights to the mailbox calendar. The following values are available:

  • CreateItems;
  • CreateSubfolders;
  • DeleteAllItems;
  • DeleteOwnedItems;
  • EditAllItems;
  • EditOwnedItems;
  • FolderContact;
  • FolderOwner;
  • FolderVisible;
  • ReadItems.

The Permission Level roles described above are just a set of granular permissions. For example, the Editor role is a set of the following individual permissions:

  • CreateItems
  • DeleteAllItems
  • DeleteOwnedItems
  • EditAllItems
  • EditOwnedItems
  • FolderVisible
  • ReadItems

These permissions can be set using the –AccessRights parameter of the Set-MailboxFolderPermission cmdlet.

Adding Calendar Permissions in Office 365 or Exchange Server Using PowerShell

In order to grant user2 the permission to view and edit user1 calendar items, run the following command:

ADVERTISEMENT
Add-MailboxFolderPermission -Identity user1@domain.com:\calendar -user user2@domain.com -AccessRights Editor

If some of the items in the calendar are marked as Private, you can allow delegating the permissions to view Private calendar items. Use the command:

Add-MailboxFolderPermission –Identity user1@domain.com:\calendar –User user2@domain.com -AccessRights Editor -SharingPermissionFlags Delegate,CanViewPrivateItems

Also, you can prepare a CSV file with a list of users, and assign them permissions to access a specific user’s calendar:

Import-Csv users.csv | foreach { add-MailboxFolderPermission -Identity "user1@domain.com:\calendar" -User $_.alias -AccessRights Owner }

In some cases, you need to grant a specific user (for example, a secretary) the permission to manage all calendars in the organization:

Foreach ($Mailbox in (Get-Mailbox -ResultSize Unlimited)) { Add-MailboxFolderPermission -identity "$($Mailbox.Name):\Calendar" -AccessRights Editor -User secretary }

You can use the parameter SendNotificationToUser of the Set-MailboxFolderPermission cmdlet to generate a “share invitation” email that summarizes your changes. The option -SendNotificationToUser $true can be used only when you set one of the following permissions via the AccessRights parameter: AvailabilityOnly, LimitedDetails, Reviewer, or Editor. The following command will send a sharing invitation to the user2:

Add-MailboxFolderPermission -Identity user1@domain.com:\calendar -user user2@domain.com -AccessRights Editor -SendNotificationToUser $true

This is what the sharing invitation will look like in Outlook:

You’re invited to share this calendar.
UserName has invited you to view his or her Calendar. Click the Open button above.

office 365 powershell calendar permissions

How to Change or Remove Mailbox Calendar Permissions with PowerShell?

If you need to change the Default permissions for the calendar folder (to allow all organization users to view a calendar of the specified user), run the command:

Set-MailboxFolderPermission -Identity user1@domain.com:\calendar -User Default -AccessRights Reviewer

Check the current calendar permissions again with the Get-MailboxFolderPermissions cmdlet. They should change:

ADVERTISEMENT
Get-MailboxFolderPermission -Identity user1@domain.com:\calendar

FolderName User AccessRights
———- —- ————
Calendar Default {Reviewer}
Calendar Anonymous {None}
Calendar user2 {Editor}

You can also grant permissions for the mailbox not to an individual user, but to the Exchange distribution group:

New-DistributionGroup -Type Security -Name “Resource Calendar Owners” -Alias “grResourceCalendarAccess” 

add-MailboxFolderPermission -Identity user1@domain.com:\calendar -User grResourceCalendarAccess -AccessRights Owner

In some cases, you need to grant Reviewer permissions on a calendar folder in all user’s mailboxes in your Exchange organization. You can make this bulk calendar permissions change using a simple PowerShell script. To change the Default calendar permission for all mailboxes to Reviewer:

foreach($usermbx in Get-Mailbox  -RecipientTypeDetails UserMailbox) { 

$usercalendar = $usermbx.alias+":\Calendar" 

Set-MailboxFolderPermission -Identity $usercalendar -User Default -AccessRights Reviewer 

}

Use the Remove-MailboxFolderPermission cmdlet to remove the calendar permissions:

Remove-MailboxFolderPermission -Identity user1@domain.com:\calendar –user user2@domain.com

If you want to reset the user’s calendar permissions to default, then run:

Get-MailboxFolderPermission brett.jackson:\Calendar | % { Remove-MailboxFolderPermission -Identity $_.Identity -User $_.User }

To exclude some “default” permissions entries from the removing script, use the following PowerShell one-liner:

Get-MailboxFolderPermission brett.jackson:\Calendar | ? {$_.User -notmatch "^(Default|Secretary|Anonymous)$"} | % { Remove-MailboxFolderPermission -Identity $_.Identity -User $_.User.ADRecipient.ExchangeObjectId.Guid -Confirm:$false }

Now you can disconnect your PowerShell session from Microsoft 365/Exchange Server:

Remove-PSSession $Session

Adding Shared Calendar in Outlook 365/2019/2016?

In order to view other calendars in Outlook 365/2019/2016 (including room resources, Shared calendars), you should switch to the calendar view and select the calendar type you want to add. You can select a user from Address Book (Global Address List – GAL), Open Shared Calendar (you should specify user name), Room List, and Internet (web-calendar).

add-mailboxfolderpermission calendar

For example, you want to add a calendar from the Global Address List. Find the calendar name you want to add to Outlook and click OK. The shared calendar should appear under the My Calendars in Shared Calendars section.

365 calendar permissions powershell

Brian Jackson started this blog in 2011. Brian has a huge passion for WordPress and technology for over a decade. Brian enjoys blogging, movies, and hiking.

39 comments

  1. I am getting the error that the [FailureCategory=Cmdlet-UserAlreadyExistsInPermissionEntryException]
    I am pretty sure they tried to setup sharing themselves and they have away/busy information only. Do you know of a way to change the permissions or remove them so I can add the PublishingEditor permissions they need?

  2. Thanks, this is very helpful! (Jason’s comment about Use Set-MailboxFolderPermission for existing users was also helpful.)

    A couple things to add:
    – “None” is also an available role
    – You can specify “Default” for the user parameter

  3. Great info

    Is it possible to use a group ( security / distribution ) to assign permissions rather than individual users ? We are looking at our resource calendars to do this on

    1. Hey, Daniel!

      Create new security distribution group:
      New-DistributionGroup -Type Security -Name “Access to Resource Calendars” -Alias “grResourceCalendAcess”
      And add users to this group.
      Grant permissions to resource calendar:
      add-MailboxFolderPermission -Identity user_name:Calendar -User grResourceCalendAcess -AccessRights Owner

  4. I get an error when trying Import-PSSession $Session. It says “The term ‘Import’ is not recognized as the name of a cmdlet…etc.”

    This is quite archaic. Is there no way to do this through the admin portal?

  5. Worked fantastically!

    If used in tandem with the PowerShell for Office 365 tool (which essentially has all of the modules built in and starts you at the domain admin login step) then it’s literally a one command job.

    Very awesome :)

  6. Getting the following error in step 7 when I run
    Get-Mailbox –database mbxdbname | ForEach-Object {Set-MailboxFolderPermission $_”:\calendar” -User Default -AccessRights Reviewer}

    I get:
    A parameter cannot be found that matches parameter name ‘database’.
    + CategoryInfo : InvalidArgument: (:) [Get-Mailbox], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Get-Mailbox
    + PSComputerName : ps.outlook.com

  7. I recieve and error about Get-MailboxFolderPermission username:\calendar.

    Get-MailboxFolderPermission : The term ‘Get-MailboxFolderPermission’
    is not recognized as the name of a cmdlet, function, script file, or
    operable program. Check the spelling of the name, or if a path was
    included, verify that the path is correct and try again.
    At line:1 char:1
    + Get-MailboxFolderPermission
    username:\calenda …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Get-MailboxFolderPermis
    sion:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    Anyone else seeing this?

    Thanks

    1. Receiving the same error:
      A positional parameter cannot be found that accepts argument ‘Get-MailboxFolderPermission $_”:\calendar”’.
      + CategoryInfo : InvalidArgument: (:) [Get-Mailbox], ParameterBindingException
      + FullyQualifiedErrorId : PositionalParameterNotFound,Get-Mailbox
      + PSComputerName : ps.outlook.com

  8. Heyhey!
    For me it says for “username:\calendar” that it cannot be found… Just “username” is found. Any ideas how to access the calendar now? :(

  9. Hi all, i have read the comments and advise above and think that it will work. However, to me the remark was made that it should be possible to read someone else’s calender, but the items that are put in the calender and are marked as private should not be (or just be basic) visible to the person accessing the calender. Does “-AccessRights Reviewer” do that or do i need more? Our Personnel Officer needs access to the CEO’s calender except for the private items.

  10. Nice write-up, thanks for the help.

    1) I’d like to hear an answer to Paul’s question as well.

    2) Trying to see the default user calendar permissions throws an error for me. When I run this:
    ” Get-MailboxFolderPermission Default:\calendar”

    I get this:
    “The specified mailbox “Default” doesn’t exist.
    + CategoryInfo : NotSpecified: (:) [Get-MailboxFolderPermission], ManagementObjectNotFoundException
    + FullyQualifiedErrorId : [Server=BYAPR11MB3510,RequestId=929235a4-b9f6-4188-8fd1-2ea5ce344d0b,TimeStamp=7/8/2019 7:35:43 PM
    ] [FailureCategory=Cmdlet-ManagementObjectNotFoundException] F470BBDC,Microsoft.Exchange.Management.StoreTasks.GetMailboxFol
    derPermission
    + PSComputerName : outlook.office365.com”

  11. for you information
    Step 5. Viewing Current Calendar Permissions with PowerShell

    last script are CHANGING permissions not only viewing.

    Get-Mailbox –database mbxdbname | ForEach-Object {Set-MailboxFolderPermission $_”:\calendar” -User Default -AccessRights Reviewer}

  12. I would like to see if there is a way to change the calendar permissions for an entire group. Just like how you gave a group permissions, I want the group to be the object with the calendar.

  13. Hi
    I am struggle to find out how to allow one user to add user defined fields to another users calendar
    I have a COM integration that works fine for my own calendar but I cannot find any way to set for another user to set their permissions on their calendar to allow me to add the field
    I can create/update/delete appointments fine
    Specifically I need this to return an odd number https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2007/cc979218(v=office.12)
    But no matter what I try in the user interface I cannot get it to return anything other than 18 which is MAPI_ACCESS_READ+MAPI_ACCESS_CREATE_CONTENTS
    Thanks

  14. When running:

    > Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn

    I get the error:

    Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 5.
    At line:1 char:1
    + Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (Microsoft.Excha…werShell.SnapIn:String) [Add-PSSnapin], PSArgumentEx
    ception
    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

  15. I keep getting an error for the Identity.
    Cannot process argument transformation on parameter ‘Identity’. Cannot convert value “User@Domain.com:calendar” to type
    “Microsoft.Exchange.Configuration.Tasks.MailboxFolderIdParameter”.

  16. 1) DO NOT open PowerShell as Administrator as it makes no sense: local administrative permission doesn’t affect the remote system anyhow!
    2) Microsoft is going or already moved connection to the Modern Authentication, which requires these commands:
    Import-Module ExchangeOnlineManagement
    Connect-ExchangeOnline -UserPrincipalName admin@youdomain.com -ShowProgress $true

  17. Thanks for the post, still a ton of useful info in here. Quick tip for others: If you want to identify which Calendars one individual user has access to, modify the command:
    Get-Mailbox | ForEach-Object {Get-MailboxFolderPermission $_”:calendar”} | Where {$_.User -like “Default”} | Select Identity, User, AccessRights

    Replacing “Default” with the name of the specific user for whom you want to identify permissions.

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

  18. Hello I’m getting this error, when trying to create a new session to 0365:

    New-PSSession : [outlook.office365.com] Connecting to remote server outlook.office365.com failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.
    At line:1 char:12 + $Session = New-PSSession -ConfigurationName Microsoft.Exchange -Conne …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OpenError: (System.Manageme….RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin gTransportException + FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed
    Can you help?

  19. I know this is a random question, but if you have given someone calendar access and it’s not appearing for them – do you need to give them mailbox access as well? I didn’t think you did unless there has been a change in recent months?

  20. Probably a really dumb question but would I be able to share all the calendars of one security group with another? For instance could I do something like this?

    add-MailboxFolderPermission -Identity grResources:\calendar -User grResourceCalendarAccess -AccessRights Owner

    Essentially I’m looking only to share the calendars of a specific set of people with another specific set of people within a division.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.