06 January 2022

Set Outlook delegate permission with PowerShell

Sometimes my users ask things I didn't know existed.

The question I got was: Why can't I see the meeting invitations sent to the persons mailbox and calendar I manage in my own inbox? I knew it had to do with delegates, but thought that could only be set by the owner of the mailbox. Turns out I was wrong, it can be set by the admin with PowerShell.

It's always PowerShell 😜

First check the current permissions:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Get-MailboxFolderPermission "TargetUser:\agenda"

FolderName           User                 AccessRights                           SharingPermissionFlags
----------           ----                 ------------                           ----------------------
Agenda               Default              {AvailabilityOnly}
Agenda               DestinationUser      {PublishingEditor}                     Delegate
Agenda               SomeUser             {Reviewer}
Agenda               SomeUser2            {LimitedDetails}
Agenda               TargetUser           {LimitedDetails}
Agenda               SomeUser3            {Editor}                               Delegate

Then remove all the existing permissions for the destination user:

 1
2
3
4
5
6
Remove-MailboxFolderPermission "TargetUser:\agenda" -User DestinationUser

Confirm
Are you sure you want to perform this action?
Removing mailbox folder permission on Identity:"TargetUser:\agenda" for user "DestinationUser".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [?] Help (default is "Y"):

There's a few things to note before setting the permissions. To be able to grant the delegate permissions and all options the AccessRight has to be "Editor", the SharingPermissionsFlags need to be separated with a comma, and the option to SendNotificationToUser expects a boolean value so set a $False for no notification or $True to send a notification to the user:

 1
2
3
4
5
add-MailboxFolderPermission "TargetUser:\agenda" -User DestinationUser -SharingPermissionFlags delegate,canviewprivateitems -AccessRights editor -SendNotificationToUser $true

FolderName           User                 AccessRights                           SharingPermissionFlags
----------           ----                 ------------                           ----------------------
Agenda               DestinationUser      {Editor}                               Delegate, CanViewPrivateItems

That's it

No comments:

Post a Comment