Software

How To Set Calendar Permissions in Office 365/Exchange via PowerShell

The Calendar function in Office 365 and Exchange is incredibly useful in helping you keep track of time, appointments, and other occasions. But to give access to others to use the file you are on currently, you might want to read this guide on how to set Calendar Permissions in Office 365/Exchange via PowerShell!

Connect Office 365/Exchange from PowerShell

In this tutorial, you may find information on how to view, add and even remove accounts from the share permission section of Office 365 via PowerShell.

In most cases, you’ll assign such permissions to a security group by granting access to the user via the Active Directory group, and this excludes the change in access via PowerShell. 

Unfortunately, such cases won’t happen anymore in the future, since in Exchange 2016/2013 and Exchange Online (Office 365), the admin (administrator) won’t be able to affect the central calendar permissions from the graphic user interface.

But for certain, you can definitely use an add mailboxfolderpermission cmdlet that’s already in the system to give yourself the power to see all user’s mailboxes from PowerShell. This cmdlet can also be used in Office 365, in case you’re wondering to yourself!

To do all that, we can start by connecting your Office 365 or the Exchange tenant right on your device. So let’s get started!

  • Right-click on Windows PowerShell CLI and choose “Run as administrator” (to be safe, do check if you’re the administrator).
Set Calendar Permissions in Office 365/Exchange via PowerShell
Image 1. Choose “Run as administrator” on the option menu.
  • Start saving your administrator’s credentials into PowerShell by running this very command: 

“$LiveCred = Get-Credential”

  • Since you’re attempting to connect to Office 365 (the very reason why you’re reading this tutorial), you’ll need to specify your tenant admin credentials like so:
Set Calendar Permissions in Office 365/Exchange via PowerShell
Image 2. Specify your tenant admin credentials.
  • After all of that’s done, let’s form a new session window to work on, based on what basis you’re working with:

For Office 365: “$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $LiveCred -Authentication Basic –AllowRedirection”

For Exchange: $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://<your-target-exchange-server-address>/powershell/ -Credential $LiveCred

  • If you run into an error warning that you’re not allowed to perform the request as a WinRM user, we suggest you check if you’re using an HTTPS connection in place of the HTTP one as well as Kerberos authentication. 

Your connection command should come to a little something like what we present here: 

“$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://ny-msg-02/powershell/ -Credential $LiveCred -Authentication Kerberos”

  • Next, you can import the management commands on Office 365/Exchange from a separate session to your PowerShell console with this line: “Import-PSSession $Session”. You might also run into an error that forces you to send a certificate to sign the file and open access to script executing.
  • Go to the settings of PowerShell Execution Policy value and adjust it to RemoteSigned.
Image 3. This is the screen you should receive.
Set Calendar Permissions in Office 365/Exchange via PowerShell
Image 4. Your export commands can also receive a warning like so.

Get Calendar Permissions in Office 365/Exchange via PowerShell

The next step to getting Office 365 calendar permissions is down below!

  • You should be able to view the current list of accesses from a certain mailbox by implementing the ALL cmdlet that is open for use in all cloud-based services and on-premises Exchange as a whole and punching the name of the mailbox in the space: 

“Get-MailboxFolderPermission username:\calendar”

Set Calendar Permissions in Office 365/Exchange via PowerShell
Image 5. You’ll receive a detailed list like so.
  • Change your username to the very account you wish to see the permissions/access in. Here’s also where another error can jump in and disrupt your work, which tells you that “get mailboxfolderpermission” is not recognized as any “cmdlet, function, script file, or operable program”. 

This only happens after you might have missed or skipped some steps in the process of connecting to Office 365/ Exchange tenants, or you haven’t imported PowerShell cmdlets to your session properly. Please scroll up and follow the instructions from the previous part in full before continuing.

  • There’s also quite a quirky case where the account you’re looking into isn’t in English, so the return of the command you punched in can be “‘username:\calendar’ not found”. 

So if that’s the situation you’re in, you can enter this line in to find out the name of the calendar in the account’s language configuration: “(Get-MailboxFolderStatistics username -FolderScope Calendar).Identity”

Image 6. Here’s what you will end up with!
  • You can begin to examine the current permission setting on the calendar with: 

“Get-MailboxFolderPermission brett.jackson:\calendar”. 

From this, you can spot the default AvailabilityOnly role that’s only on the calendar folder.

Image 7. The access rights section is right under User.
  • If you don’t have time to go through the entire list of users, you can pull up a full list of calendar permissions from all folders of your organization with this command: 

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

A List Of Roles For Calendar Users and Sharing 

Here’s a list of roles/properties that can be assigned to accounts by users as well as admins:

  • Owner: The most inclusive of the folder. The owner can give and take away access and modification rights for everyone regarding their file. In addition to that, the owner is allowed to create, edit, and manage all the items of the folder.
  • PublishingEditor: All of the above, aside from changes in access and permissions.
  • Editor: All of the above, except for changes in access and creating subfolders where they’re working on.
  • Author: The author is able to create and read items, but they can only make editions and delete the items they have made and no other.
  • NonEditingAuthor: All of the above, yet unable to change any items whatsoever, not even their own.
  • Reviewer: Can only read the items in the folder.
  • Contributor: Can create and read their own items, but not others.
  • AvailabilityOnly: This role cannot see anything aside from the Free/Busy inputs from the calendar.
  • LimitedDetails: Can see availability data, calendar item subject, and location only.
  • And finally, None.

All in all, each role already has its own set of rights and accesses, but in case you want to tailor your own settings, you will find this list of values for mailbox calendars useful: 

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

You can thank the –AccessRights parameter, which belongs to the Set MailboxFolderPermission cmdlet, for all these personalization features, so do look out for this amazing function!

With all those set-ups done, you can scroll down to learn the script to modify mailbox permissions to your needs and wants right now!

Set Calendar Permissions in Office 365/Exchange via PowerShell

The meat of this very tutorial is here. Let’s get to work!

  • To grant certain User2 access to a mailbox calendar from User1, you may run this command: 

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

This is the most general way of reaching your end goal, but this certainly is not the end of this tutorial.

  • If a file is set as “Private”, you should try passing off the permissions to see information presented in a Private calendar. This can be done with the line:

“Add-MailboxFolderPermission –Identity [email protected]:\calendar –User [email protected] -AccessRights Editor -SharingPermissionFlags Delegate,CanViewPrivateItems”

  • In case a change in the Default permissions needs to be made (for an occasion where all users in your organization need to see a calendar from a specific user), you can use this command:

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

So let’s say that your boss orders you to publicize a general timeline for your company to follow; this is the function you will need to utilize.

  • To check the mailbox calendar’s permission section once more, you can use the Get-MailboxFolderPermissions cmdlet with this line: “Get-MailboxFolderPermission -Identity [email protected]:\calendar”. Afterward, you can start modifying the permission roles according to the list we’ve discussed before to give them certain rights and access.
  • Aside from giving accounts permissions, you may also be able to do so for the Exchange distribution group with the commands: 

“New-DistributionGroup -Type Security -Name “Resource Calendar Owners” -Alias “grResourceCalendarAccess”, “add-MailboxFolderPermission -Identity [email protected]:\calendar -User grResourceCalendarAccess -AccessRights Owner”

  • If there are plans in mailbox calendars that require proofreading, you, as the administrator, have the capability to grant the Reviewer role to a user on all folders in the system. That’s certain, but the traditional route will be arduous.

To set such a role in one step, please use this command:

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

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

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

  • To set up a CSV file for a predetermined list of accounts, you may put this command to action:

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

Here’s also quite a nifty trick for you: Send a notification to all those people whom you just shared the file by using the SendNotificationToUser parameter of the Set-MailboxFolderPermission cmdlet. The notification shall arrive in the form of an email that lets the recipients in on all the changes you’ve made regarding sharing rights.

The command to send that notification email is:

“Add-MailboxFolderPermission -Identity [email protected]:\calendar -user [email protected] -AccessRights Editor -SendNotificationToUser $true”

Image 8. The generated message will end up being presented like this.

These are the tools that you can use to your convenience, so please keep note of these functions for future applications. With that, let’s move on to learning how to bring your creations onto the platforms such as Outlook 2016!

Integrate Shared Calendar Into Outlook 2016

The calendar functions of Outlook 2016 are not that complicated once you get the hang of it. We advise switching to the calendar view and select the calendar type to add it into the mix. 

Aside from adding accounts like usual, you can select a user from Address Book (Global Address List – GAL), Open Shared Calendar (you should specify user name), Room List, Internet (web-calendar). That’s just how diverse this application can be!

Image 9. Here’s where you can find the contacts!

From the list on the image above, you’ll be able to access all kinds of contacts and find yourself the one that’s most proper for that particular calendar folder.

Image 10. Here’s where you can find the calendars that went through sharing!

Delete And Undo Calendar Permissions via PowerShell

We’re reaching the end of the guide already. Let’s wrap this up nicely on how to undo mistakes you might have made or changes in the calendar permission list!

  • Removing accounts off access is quite easy. Use this command from the Remove-MailboxFolderPermission cmdlet:

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

  • Aside from removing it, you can undo changes from a user’s access settings by returning the attached values to their default state:

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

  • With PowerShell, you can leave out a few “default” permissions receivers from the script you’re using. Simply input the command:

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

  • And finally, if you ever want to disconnect your PowerShell session and remove everything you have done on it from the application, you may utilize this line:

“Remove-PSSession $Session”

If you want to fully control what you do regarding mailbox calendar permissions, you’ll need to learn how to undo on the same level as you create!

Image 11. Your trusty calendar is here!

Outro: That should be it for this tutorial on how to set Calendar Permissions in Office 365/Exchange via PowerShell! There are definitely plenty of scripts you can follow out there, but you can keep this article around as a safe point to return to whenever errors occur, or you need to redo some features. Don’t hesitate to retrace your step, and good luck out there!

Maybe you are interested in

Leave a Reply

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

Back To Top