mercredi 29 octobre 2014

How to get all Site Collections using C# CSOM


Vote count:

0




My Code: SPOSitePropertiesEnumerable spp = null; Microsoft.Online.SharePoint.TenantAdministration.Tenant tenant = new Tenant(clientContext); int startIndex = 0;



while (spp == null || spp.Count > 0)
{
spp = tenant.GetSiteProperties(startIndex, true);
clientContext.Load(spp);
clientContext.ExecuteQuery();

foreach (SiteProperties sp in spp)
{
Response.Write("<br/> All Sites Collection: " + sp.Title + "<br/>");
// siteCols.Add(new SiteCol(sp.Title, sp.Url));

// startIndex = siteCols.Count;
}
startIndex++;
}


I am getting this Error : Method Microsoft.SharePoint.Client.ClientRuntimeContext.Load: type argument 'Microsoft.Online.SharePoint.TenantAdministration.SPOSitePropertiesEnumerable' violates the constraint of type parameter 'T


Is there any other way to retrieve all site collections?



asked 48 secs ago







How to get all Site Collections using C# CSOM

Aucun commentaire:

Enregistrer un commentaire