One of the completely new features to ship with SharePoint and Exchange 2013 is the new Site Mailboxes capability to give a unified view of both documents and emails in SharePoint and Outlook. For an overview of the feature, see the Product Group's posting here and for first time configuration information see here.
In this post, I'll be exploring how Site Mailbox provisioning can be automated in an on premises install of Exchange and SharePoint. At present, hybrid scenarios are not supported for Site Mailboxes - i.e. both SharePoint and Exchange should either be on premises or both in the Cloud.
I’ll be running these commands from a SharePoint server and so using remote PowerShell to connect to the Exchange server (called ukmcs15-ex in this example). The following code needs credentials with permission to allow site mailbox creation.
$user = Get-Credential
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://ukmcs15-ex/powershell -Credential $user
First, in my lab environment, I need to do some one off housekeeping to support OAuth over HTTP. Please note, this is not recommended for production environments and only used here to simplify the configuration without using SSL certificates:
$s = Get-SPSecurityTokenServiceConfig
$s.AllowMetadataOverHttp = $true
$s.AllowOAuthOverHttp = $true
Now, I’ll define the variables for my mailbox. This includes its team site URL, mailbox alias, mailbox display name and one mailbox owner.
$url = http://fifteen/sites/AnotherSiteMailbox
$address = "anothersitemailbox"
$display = "Another Site Mailbox"
$owner = "UKMCS\alexdo"
Let’s do the SharePoint configuration first.
$site = New-SPSite -Url $url -OwnerAlias $owner -Template "STS#0" -Name $display
$web = $site.OpenWeb()
Enable-SPFeature "CollaborationMailbox" -Url $url
And now the Exchange side to create and link the site mailbox.
$mailbox = New-SiteMailbox -SharePointUrl $url -Name $address -DisplayName $display
$mailbox | Set-Mailbox -Language "en-GB"
$mailbox | Set-MailboxRegionalConfiguration -TimeZone "GMT Standard Time"
You’ll see how I’ve deliberately set a mailbox owner and regional configuration to allow end users to open the Outlook Web Access view without additional prompts.
The finished result in Outlook:
Whilst this code sample is basic, I hope it provides a starting point to allow scripting of site mailbox creation to meet your requirements.
Microsoft Consulting Services UK