I'm creating low-trust addin for sharepoint and trying to get list of all site collections using CSOM. This code works good for SharePoint Online:
using (var context = GetAppOnlyClientContext(hostUrl))
{
var tenant = new Tenant(context);
var siteProperties = tenant.GetSiteProperties(0, true);
context.Load(siteProperties);
context.ExecuteQuery();
var result = siteProperties.ToList();
}
But when I'm trying to run this code on SP 2016 instance, I get following exception:
Cannot find stub for type with id {268004ae-ef6b-4e9b-8425-127220d84719}. The specified server may not support APIs used in this operation.
I'm using CSOM version 16.0.
So the question is: Can I receive list of site collection using CSOM? If yes, how can I avoid this error?