Hi i am creating Office 365 SharePoint APP(SharePoint Hosted).

Now i need to get all site collection of tenant in my office 365 app.

How to a get all site collection using JSOM (According to my knowledge i can use only JavaScript in SharePoint App).

Or can i use CSOM on SharePoint Office 365 apps? I found a blog Here to get all site collection using CSOM.

Please help me..


1 Answer 1


You can do this by the following script in CSOM

SPOSitePropertiesEnumerable spp = null;
var tenant = new Tenant(ctx);
int startIndex = 0;

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

    foreach (SiteProperties sp in spp)
        siteCols.Add(new SiteCol(sp.Title, sp.Url));

   startIndex += spp.Count;

Please, see: http://sprecipe.com/2015/11/04/sharepoint-online-retrieve-all-site-collections-via-csom/ or https://stackoverflow.com/questions/24405584/sharepoint-csom-retrieving-site-collections-limited-to-300/24406495#24406495

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.