Unable to add Microsoft Exchange Public Folders of type Calendar, Contact and Task in HC


Question: Unable to add Microsoft Exchange Public Folders of type Calendar, Contact and Task through Hosting Controller

Answer:

Occasionally Hosting Controller may encounter an error while adding Public Folders of type Calendar, Contact and Task in Exchange. The following underlying reasons could lie at the root of this failure and can be rectified by following the allied steps:    

1) InternalUrl for Exchange Web Services throws an error while browsing.
 
A common reason which might cause the issue is that the InternalUrl for Exchange Web Services is inaccessible.
 
Solution: The InternalUrl for Exchange Web Service Virtual Directory can be corrected with the help of this Link.
 
InternalUrl for Exchange Web Services can be retrieved through the following PowerShell command:

Get-WebServicesVirtualDirectory |fl *url

2) HC Remoting Service is running under a user which is either not an Administrator or a mailbox user. 
 
It is to be noted that client Public Folders (Calendar\Contact\Task) can only be created via Exchange Web Services API and not through PowerShell commands. Moreover Exchange assigns Public Folder Permissions only to mail-enabled AD users and not to simple AD users therefore having the HC Remoting Service run under a non-Administrator or a simple AD user (not mail-enabled) will result in failure.

As the user would not be carrying client permissions needed by Exchange Web Services API to create Public Folders of type Calendar\Contact\Task, creation through HC obviously would fail.
 
The situation can be tackled in two ways:

Solution 1: Enable mailbox on HC Remoting user in Exchange Server.

After enabling a mailbox on HC Remoting Service user, run the following command to assign 'Owner' permission on all organization Public Folders, which exist under the Public Folder root '\':

Get-PublicFolder '\' -GetChildren |Add-PublicFolderClientPermission -user hcremotingUser@Domain -AccessRights Owner

Solution 2: Run HC Remoting Service under a user which already is mailbox enabled or run it under an Administrator.