woensdag, januari 13, 2016

CSOM tenant API support on-premise

A while ago I tried out the CSOM tenant API on-premise with SharePoint 2013. I then thought that I wasn’t able to get it working.

Then “Vesku” published a new blog on this matter:

http://blogs.msdn.com/b/vesku/archive/2015/12/04/sharepoint-tenant-csom-object-support-in-sharepoint-2013-and-2016.aspx

It appears that only a limited set of the tenant CSOM API is supported on-premise. For example, I tried to read the app catalog, but that does not work.

He writes:
All other methods of the Tenant object are not supported and will cause for exceptions due dependencies on site subscription, which typically does not exist in the on-premises deployment.
Therefore, this fragment does not work:
# http://zimmergren.net/technical/office-365-dev-tip-getting-all-apps-from-your-tenant-app-catalog-using-the-office-365-csom-api
$coll = $tenant.GetAppInfoByName([string]::Empty)
$tenant.Context.Load($coll)
$tenant.Context.ExecuteQuery()

Resulting in the exception:
Exception calling "ExecuteQuery" with "0" argument(s): "The method GetAppInfoByName does not exist."

But, this does work:
$site = $tenant.GetSiteByUrl($siteUrl)
$ctx.Load($site)
$ctx.ExecuteQuery()
$site.Id

Bottom-line I managed to get the maximal achievable result on-premise after all..
Is there a DSC script available to activate the tenant API? ;)

Geen opmerkingen: