{"id":2505,"date":"2018-06-14T23:29:44","date_gmt":"2018-06-14T23:29:44","guid":{"rendered":"http:\/\/microsoftgeek.com\/?p=2505"},"modified":"2018-06-14T23:30:53","modified_gmt":"2018-06-14T23:30:53","slug":"powershell-how-to-add-and-remove-calendar-and-contacts-permissions-for-office-365-users-via-powershell","status":"publish","type":"post","link":"https:\/\/microsoftgeek.com\/?p=2505","title":{"rendered":"PowerShell \u2013 How to Add and Remove Calendar and Contacts permission&#8217;s for Office 365 User&#8217;s via PowerShell"},"content":{"rendered":"<p>How to add, and remove, contacts and calendars permissions for users of Office 365 by using PowerShell. This can be useful should you have trouble trying to add permissions over Outlook.<br \/>\nThe first you need to connect to the Office 365 Exchange\u00a0Powershell, open a\u00a0Powershell\u00a0session and enter these commands, providing your Office 365 admin account details when requested:<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000;\"><em>$cred = Get-Credential\u00a0<\/em><\/span><\/p>\n<p><span style=\"color: #ff0000;\"><em>$session = New-PSSession\u00a0-ConfigurationName\u00a0Microsoft.Exchange\u00a0-ConnectionUri\u00a0https:\/\/ps.outlook.com\/powershell\/\u00a0-Credential $cred -Authentication Basic \u2013AllowRedirection\u00a0<\/em><\/span><\/p>\n<p><span style=\"color: #ff0000;\"><em>Import-PSSession\u00a0$session\u00a0<\/em><\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Now you can get on with the adding and removing user permissions.<\/p>\n<p>&nbsp;<\/p>\n<p><b>Check current permissions<\/b><br \/>\n<b>Before you start adding permissions, check if there are any existing permissions on the folder first. If a user already has permissions for another user\u2019s contacts\/calendar folder then you won&#8217;t be able to change them until the permissions are removed. To do this, type in the following code:<\/b><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000;\"><em>Get-MailboxFolderPermission\u00a0-Identity\u00a0user@domain.com:\\Calendar|\u00a0Select User,\u00a0AccessRights, Deny<\/em><\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Change\u00a0user@domain.com\u00a0with\u00a0which ever\u00a0user you want to view. Also Calendar can be changed for Contacts if you want to view who has access to the contacts folder.<\/p>\n<p>&nbsp;<\/p>\n<p>Once you&#8217;ve chosen the permissions you wish to give the user you can add the permissions using PowerShell. Use to following code to do this:<\/p>\n<p>&nbsp;<\/p>\n<p><em><span style=\"color: #ff0000;\">Add-MailboxFolderPermission\u00a0-Identity\u00a0user@domain.com:\\Calendar\u00a0-AccessRights\u00a0[Permission goes here] -User\u00a0user2@domain.com<\/span>\u00a0<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>Replace the\u00a0User@domain.com\u00a0with the mailbox you want to add permissions to and\u00a0user2@domain.com\u00a0to the mailbox you want to have access. Also change [Permission goes here] to whatever permission you wish to use from the list above.<\/p>\n<p>&nbsp;<\/p>\n<p><b>Remove Permissions<\/b><br \/>\n<b>Lastly, if you want to remove some permissions then you can use this line of code:<\/b><\/p>\n<p><span style=\"color: #ff0000;\"><em>Remove-MailboxFolderPermission\u00a0-Identity\u00a0user@domain.com:\\Calendar\u00a0-User\u00a0user2@domain.com<\/em><\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to add, and remove, contacts and calendars permissions for users of Office 365 by using PowerShell. This can be useful should you have trouble trying to add permissions over Outlook. The first you need to connect to the Office 365 Exchange\u00a0Powershell, open a\u00a0Powershell\u00a0session and enter these commands, providing your Office 365 admin account details [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59],"tags":[],"class_list":["post-2505","post","type-post","status-publish","format-standard","hentry","category-powershell"],"_links":{"self":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/2505","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2505"}],"version-history":[{"count":3,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/2505\/revisions"}],"predecessor-version":[{"id":2508,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/2505\/revisions\/2508"}],"wp:attachment":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2505"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}