Editing calendar permissions Office 365 with powershell

After adding a new user into Office 365, the user has to be allowed to read/write some shared calendars withing the organization.

First of all you will need to connect to Office 365

Add permission to the calendar

[codesyntax lang="powershell"]

Add-MailboxFolderPermission calendar@company.com:\Calendar -User dude@company.com -AccessRights Author

[/codesyntax]

Note: AccessRights can be: Owner, PublishingEditor, Editor, PublishingAuthor, Author, NonEditingAuthor, Reviewer, Contributor, AvailabilityOnly, LimitedDetails

Get permission for a specific users

[codesyntax lang="powershell"]

Get-MailboxFolderPermission -Identity calendar@company.com:\Calendar -User dude@company.com

[/codesyntax]

To remove permissions for a specific user:

[codesyntax lang="powershell"]

Remove-MailboxFolderPermission -Identity calendar@company:\calendar -user dude@company.com

[/codesyntax]

 

UPDATE:

What if you need to change the calendar permissions for all users within your organization?!

[codesyntax lang="powershell"]

$allmailbox = Get-Mailbox -Resultsize Unlimited

Foreach ($Mailbox in $allmailbox)
{
    $path = $Mailbox.alias + ":\" + (Get-MailboxFolderStatistics $Mailbox.alias | Where-Object { $_.Foldertype -eq "Calendar" } | Select-Object -First 1).Name
    Set-mailboxfolderpermission –identity ($path) –user Default –Accessrights AvailabilityOnly
}

[/codesyntax]

  1. Kris Wiszowaty

    Thanks for the detailed descriptions in this post. I was wondering if you would know if there was a way to give permissions to an Active Directory OU group instead of individual Users. We use a hybrid system with MS365 Online and On prem.

    • Hi Kris,

      I haven't tried, but this should work.

      $ou-users = Get-ADUser -Filter * -SearchBase "ou=testou,dc=iammred,dc=net"
      Foreach ($Mailbox in $ou-users)
      {
      $path = $Mailbox.alias + ":\" + (Get-MailboxFolderStatistics $Mailbox.alias | Where-Object { $_.Foldertype -eq "Calendar" } | Select-Object -First 1).Name
      Set-mailboxfolderpermission -identity ($path) -user Default -Accessrights AvailabilityOnly
      }

      Later edit: by "Active Directory OU" you meant "Distribution Group"? If so, then:

      $dg-users = Get-DistributionGroupMember -Identity "distribution-group@company.com"
      Foreach ($Mailbox in $dg-users)
      {
      $path = $Mailbox.alias + ":\" + (Get-MailboxFolderStatistics $Mailbox.alias | Where-Object { $_.Foldertype -eq "Calendar" } | Select-Object -First 1).Name
      Set-mailboxfolderpermission -identity ($path) -user Default -Accessrights AvailabilityOnly
      }

      More info here:

      http://blogs.technet.com/b/heyscriptingguy/archive/2012/10/30/powertip-single-line-powershell-command-to-list-all-users-in-an-ou.aspx
      https://technet.microsoft.com/en-us/library/aa996367(v=exchg.150).aspx

    • I assume you run Azure AD Connect to sync between 365 and on prem, if so, the easiest way i have found to do this is to create a mail-enabled group directly in 365, add the members you want, and then set the group as author

      Just did this my self:

      PS C:\WINDOWS\system32> Add-MailboxFolderPermission singsing@xyz.se:\Kalender -User kalendrar@xyz.se -AccessRights Author

      FolderName User AccessRights
      ---------- ---- ------------
      Kalender Kalendrar@xyz.se {Author}

      noteworthy is that the calendar might not be named in english if you have a site configured in another language as my customers calander folder was named \Kalender

  2. Hey thank for the help! I was wondering, after i changes the permissions to reviewer, how can everyone bring up all the calendars in there side bar selection in outlook? i.e. how can they view the calendars, without having to search for the owner?

    • Hi, I got the same question as Spencer.

      If that's not possible though, is there a command or script to list down all calendars, sub calendar each user has (if they've created or shared any), along with the sharing permissions set for each calendar.

      Thanks!

  3. Thank you for posting this - made my afternoon so much easier!

  4. Is there a way that we can give all users permissions to view details on each other's calendar by default ? So they can see all calendars in their outlook by default and be able to see their appointment details? How do we accomplish that with powershell?

  5. Is there a way in 365 to stop the ability of a user requesting permissions to have access to another user's calendar? We have users who go into someone else's calendar and try to go into a meeting and it tells them they don't have access, do you want to request access? The person clicks yes and then it brings up a form to send to the user they want access to, and you fill out some stuff and send it. We want to stop that kind of sharing from happening. Thanks!

  6. Claus Nørgaard

    Great article, worked on first try.
    Not all heroes wears capes!

    Thanks a lot, now I'm interested to see what else you have in your portfolio :)

  7. Haydn Walker

    Hi

    My PS script doesn't seem to work - code below: It seems to have a problem with the $email.alias although there is a value stored in it.
    # Adds Exchange Management 2010 Snap-in #
    add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010;

    # Loads .NET Framework to allow use of VisualBasic Input Box #
    [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null

    # Shows message box and takes the assigns the value to the $email variable #
    $email = [Microsoft.VisualBasic.Interaction]::InputBox("Enter an Email Address", "User to run Action on", "")

    Get-mailbox -Identity $email

    ### TEST $EMAIL HAS A VALUE ###
    Write-Output $email

    # Shows message box and takes the assigns the value to the $folder variable #
    # $folder = [Microsoft.VisualBasic.Interaction]::InputBox("Enter a Mailbox Folder", "User to run Action on", "This Is Case Sensitive")

    # Get Permissions that the person entered has to mailboxes

    $path = $email.alias+":\Calendar"

    ### TEST $PATH IS COMPLETE ###
    Write-output $path

    Get-MailboxFolderPermission -identity $path

    Does anyone have any ideas why it's not working - the command Get-MailboxFolderPermission works fine if I manually give it a value (as opposed to a variable)

  8. Your blog rocks! Thanks for putting this info out there! Way easier to follow then surfing through Microsofts hundreds of pages. :)

  9. Hi

    I need something similar to this. Currently got on-premise exchange 2016 and AD on prem with O365 connected. All mailboxes/calendars have recently been migrated to O365 accounts as part of the upgrade to exchange 2016

    I need to change calendar default permission to Reviewer for all mailboxes in a specific OU. Any ideas how I apply the filter for AD OU to this?

    What if you need to change the calendar permissions for all users within your organization?!
    $allmailbox = Get-Mailbox -Resultsize Unlimited

    Foreach ($Mailbox in $allmailbox)
    {
    $path = $Mailbox.alias + ":\" + (Get-MailboxFolderStatistics $Mailbox.alias | Where-Object { $_.Foldertype -eq "Calendar" } | Select-Object -First 1).Name
    Set-mailboxfolderpermission –identity ($path) –user Default –Accessrights AvailabilityOnly
    }

  10. Hi

    Great article, thanks for the notes.

    We created a Resource on-prem, I haven't migrated to office365 yet, but the rest of the business have. I added myself as Owner of the mailbox and added permission for myself. When I try to add the rest of the user manually, the names appear but I cant add them (believe casue they have been migrated). I havent migrated resource yet to 365, is there way to add the users?

    thanks

Scrie si tu o vorbulita


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

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