Skip to content

Export Microsoft 365 calendar permissions with PowerShell

The Availability Only role is set for each user mailbox calendar by default. This means that the other users have permission to view only the free or busy time in the calendar folder. Some users have other permissions that allow them to see additional information in the calendar folder. It’s best to get an overview of the calendar folder permissions of each mailbox. In this article, you will learn how to export Microsoft 365 calendar permissions with PowerShell.

Microsoft 365 mailbox calendar permissions

Each user can share their calendar folder and set the level of permissions with single or multiple users. The users can have different levels of permissions on their calendar folder.

The -AccessRights parameter specifies the permissions for the user with the roles. The list below shows all the calendar roles with the permissions that come along when you assign access rights to the mailbox folder.

RolesPermissions
AvailabilityOnly
(Default value)
View only availability data (Free/Busy time)
NoneNo permission to access folders and files
LimitedDetailsView availability data with subject and location (Free/Busy time, subject, location)
OwnerCreateItems, ReadItems, CreateSubfolders, FolderOwner, FolderContact, FolderVisible, EditOwnedItems, EditAllItems, DeleteOwnedItems, DeleteAllItems
PublishingEditorCreateItems, ReadItems, CreateSubfolders, FolderVisible, EditOwnedItems, EditAllItems, DeleteOwnedItems, DeleteAllItems
EditorCreateItems, ReadItems, FolderVisible, EditOwnedItems, EditAllItems, DeleteOwnedItems, DeleteAllItems
PublishingAuthorCreateItems, ReadItems, CreateSubfolders, FolderVisible, EditOwnedItems, DeleteOwnedItems
AuthorCreateItems, ReadItems, FolderVisible, EditOwnedItems, DeleteOwnedItems
NonEditingAuthorCreateItems, ReadItems, FolderVisible
ReviewerReadItems, FolderVisible
ContributorCreateItems, FolderVisible

To get all calendar folder permission for a user, use the Get-MailboxFolderPermission PowerShell cmdlet.

Note: Users from other countries with languages other than English have different names for Calendar. Therefore, we will always add the Get-MailboxFolderStatistics PowerShell cmdlet in our commands and scripts to retrieve the correct name.

Connect to Exchange Online PowerShell

Before you start, you need to Install Exchange Online PowerShell module. Then run the below PowerShell cmdlet to Connect to Exchange Online PowerShell.

Connect-ExchangeOnline

Get calendar permissions for single mailbox

You can export all the mailboxes that have access rights on the calendar folder of a specific user mailbox.

Export Microsoft 365 calendar permissions for single mailbox

In our example, we want to export the calendar permission of a single user (Brenda.Smith@m365info.com).

  1. Specify the user mailbox in line 1
  2. Run the PowerShell script
$mailbox = "Brenda.Smith@m365info.com"

$folder = (Get-MailboxFolderStatistics -Identity "$($mailbox)" | Where-Object { $_.FolderType -eq "Calendar" }).Name
Get-MailboxFolderPermission "$($mailbox):\$($folder)" | Select-Object FolderName, User, AccessRights

The PowerShell output shows the calendar folder permissions for the single user.

FolderName User           AccessRights
---------- ----           ------------
Agenda     Default        {AvailabilityOnly}
Agenda     Anonymous      {None}
Agenda     Stephen Hunter {AvailabilityOnly}
Agenda     Amanda Hansen  {Reviewer}

Export calendar permissions for all mailboxes to CSV

Depending on the calendar folder settings, some mailboxes have different calendar permissions than others. Therefore, you can view the access rights of the calendar folder for each mailbox.

To export calendar folder permissions for all the Microsoft 365 mailboxes to an Out-GridView and CSV file, follow these steps:

  1. Create a temp folder in your (C:) drive
  2. Specify the CSV path file in line 2
  3. Run the below PowerShell script
# CSV file export path
$Csvfile = "C:\temp\MailboxCalendarPerms.csv"

# Get all mailboxes
$mailboxes = Get-Mailbox -ResultSize Unlimited

# Count the total number of mailboxes
$totalMailboxes = $mailboxes.Count
$currentMailboxIndex = 0

# Array to store the results
$calendarPermissions = @()

foreach ($mailbox in $mailboxes) {

    $currentMailboxIndex++

    # Update the progress bar
    $progressParams = @{
        Activity        = "Processing Mailboxes"
        Status          = "Processing mailbox $currentMailboxIndex of $totalMailboxes ($($mailbox.UserPrincipalName))"
        PercentComplete = ($currentMailboxIndex / $totalMailboxes) * 100
    }

    Write-Progress @progressParams

    # Get the Calendar folder for the current mailbox
    $folder = (Get-MailboxFolderStatistics -Identity $mailbox.UserPrincipalName | Where-Object { $_.FolderType -eq "Calendar" }).Name

    if ($folder) {
        # Get permissions for the Calendar folder
        $permissions = Get-MailboxFolderPermission "$($mailbox.UserPrincipalName):\$($folder)" | Select-Object FolderName, User, AccessRights

        # Add the permissions to the array with user principal name and display name
        $permissions | ForEach-Object {
            $calendarPermissions += [PSCustomObject]@{
                UserPrincipalName = $mailbox.UserPrincipalName
                DisplayName       = $mailbox.DisplayName
                FolderName        = $_.FolderName
                User              = $_.User
                AccessRights      = $_.AccessRights
            }
        }
    }
}

# Clear progress bar
Write-Progress -Activity "Processing Mailboxes" -Completed

# Display the results
$calendarPermissions | Out-GridView -Title "Mailbox Calendar Permissions"
$calendarPermissions | Export-Csv -Path $Csvfile -NoTypeInformation -Encoding utf8
  1. The Out-GridView result appears
Export Microsoft 365 calendar permissions with PowerShell to Out-GridView
  1. Open the CSV file with Microsoft Excel to see the results
Export Microsoft 365 calendar permissions with PowerShell to CSV file

That’s it!

Read more: Manage mailbox folder permission with PowerShell »

Conclusion

You learned how to export Microsoft 365 calendar permissions for all mailboxes with PowerShell. While it’s possible to sign in as the user and check the calendar permission from the Outlook app or Outlook on the web (OWA), it’s time consuming. It’s best to use PowerShell to get and export the calendar permissions for all user mailboxes to a CSV file.

Did you enjoy this article? You may also like Manage mailbox permissions with PowerShell. Don’t forget to follow us and share this article.

o365info Team

o365info Team

This article was written by our team of experienced IT architects, consultants, and engineers.

This Post Has 0 Comments

Leave a Reply

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