Tuesday, April 17, 2012

Enabling Calendar Sharing in Office 365

We recently worked with a customer who moved their mailboxes to the cloud, and now run their organization on Office 365. Mailbox migration was smooth, but enabling calendar sharing (vital requirement) proved to be a larger task. After reading tons of Microsoft Technet articles and posts, we were able to get calendar sharing/permissions all sorted out (disabled by default in Office 365). Read the full blog article to follow the steps, a word of warning though, we'll be using Powershell today.

To start, you'll need to install and configure the Microsoft Online Services Module for Windows PowerShell . You can follow the instructions here to do so, it's easy enough.

Next we'll want to open the Microsoft Online Services Module for Windows Powershell program. It will launch like any other Powershell program. Once loaded, we need to give Powershell the credentials we'll be logging in to Office 365 as. These need to be for a user with Administrator privileges in your Office 365 domain. To do so, run the following command:

  • $credentials = Get-Credential
    • This will spawn a window asking for credentials, enter your Office 365 administrative credentials.   

Once Powershell has your credentials, we need to log into the Office 365 servers using the credentials we just set, and start our remote session. Use the command below to do so.

  • $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $credentials -Authentication Basic -AllowRedirection
    • This might take a few seconds to complete.

Next, we need to lower our shell security. This enables us to run the cmdlet after this which executes a script from Microsoft’s servers. Use this command to do so:
  • Set-ExecutionPolicy -ExecutionPolicy unrestricted
Now we need to import the Powershell commands, from the Microsoft servers, to our local session. Use the command below to do so.
  • $ImportResults = Import-PSSession $session

Once that finishes, we should restore our default shell security. Use the command below to restore our default Execution Policy.
  • Set-ExecutionPolicy -ExecutionPolicy  restricted
All that's left now is to turn on the calendar sharing. It's a longer command, but it will set a default policy for enabling calendar sharing across the domain.
  • Set-SharingPolicy ‘Default Sharing Policy’ –Domains ‘*: CalendarSharingFreeBusySimple’
You can now exit Powershell using the 'Exit' command. Sharing has now been enabled across your organizational domain! Users can now publish their calendars, and share them with other users. Feel free to comment below if you run into any issues.