Forum Discussion

Patrick Rote's avatar
Patrick Rote
Iron Contributor
Nov 06, 2020

Can i get a list of all site collections in a tenant using power automate?

Hi All,

Will it be possible to get  a list of all site collections in a tenant using power automate?
Currently I'm using powershell and have to query the sharepoint admin site.

But i'm thinking power automate can do similar?

 

Thanks 

  • ganeshsanap's avatar
    ganeshsanap
    Jul 14, 2023

    JeanneDarche Are you using Send HTTP Request to SharePoint action? what is the the Uri/endpoint you are using?

     

    Usually, you can add &$top=5000 at the end of REST API endpoint to get more than 100 items.


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

  • Patrick Rote 

    In SharePoint admin center site, there is one list with name "DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECOLLECTIONS" which contains the list of all site collections in tenant.

     

    So, you can call SharePoint REST APIs using "Send an HTTP request to SharePoint" action in Power Automate to fetch the items from above list which will have details about site collections.

     

    ReferenceGet All Site Collections Of Office 365 Tenant In MS Flow 


    Please click Mark as Best Response if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

     

    • Sandy Ussia's avatar
      Sandy Ussia
      MVP

      Hi Patrick Rote ,

       

      In case you haven't already figured this out... Yes, you can use the "Invoke an HTTP request (Azure AD)" to issue a Graph query to get all sites. See the Graph documentation for an example to test in Graph Explorer with your credentials. 

      Then Parse JSON to get at the individual fields, and then do whatever you wanted to do. In the example below, I'm just displaying them in an HTML table which could then be emailed or whatever.

       

      [Sorry, image attached - I couldn't embed it for some reason.]

      Does this help you...?

       

      Sandy

      • ganeshsanap's avatar
        ganeshsanap
        MVP

        Sandy Ussia 

         

        The query you mentioned in your answer will return all the sites (and subsites) and not only site collections in tenant.

         


        Please click Mark as Best Response if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

         

Resources