How to get all the tenant site collections using CSOM and PowerShell!

This script allows to get all the site collections for a SharePoint Online tenant using the SharePoint Client Side Object Model (CSOM). The script defines a function that loads the CSOM assemblies and uses the Tenant object defined in the Microsoft.Online.SharePoint.Client.Tenant

 
 
 
 
 
5 Star
(2)
1,695 times
Add to favorites
Office 365
10/1/2014
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • access Tenant info REST endpoint
    3 Posts | Last post July 24, 2016
    • Hi, 
      
      Since the powershell going through CSOM, it MUST be an REST endpoint the exposes the same information. I am in the middle of trying to fulfill the same function using JavaScript, but does NOT seem able to find any publication regarding the REST api endpoints.
      
      Any information would be greatly appreciated.
      
      -Ning
    • BTW, using search rest API with contentclass:STS_Site does NOT work, it just simply not able to return all site collections even using tenant admin credential. So Search is OUT.
    • Hi,
      I recommend you to post this question to SharePoint MSDN Forums, you will find there help for sure.
      
      Kind regards,
  • Limited to 300 site collections
    1 Posts | Last post November 16, 2015
    • Hello,
      
      I wrote a similar script a year ago and I noticed something about "GetSiteProperties" method.
      It will only retrieve the first 300 site collections from the startIndex parameter.
      
      You can find my code to get all site collections here:
      http://sprecipe.com/2015/11/04/sharepoint-online-retrieve-all-site-collections-via-csom/