Forum Discussion
Patrick Rote
Nov 06, 2020Iron Contributor
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 po...
- 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.
JeanneDarche
Jul 12, 2023Copper Contributor
Sandy Ussia
Jul 13, 2023MVP
Sure!
Here's a screenshot of the Parse JSON action:
Body is from the Invoke HTTP Request action.
The Schema is based on that HTTP request (https://graph.microsoft.com/v1.0/sites?search=*) from the Microsoft Graph. My flow is nearly 3 years old at this point, so the content returned by that request might be a little different now. I would recommend using the Generate from sample button in the Parse JSON action to paste in sample JSON from that HTTP request. You could perform the request in the Graph Explorer to make sure you're getting what you expect, and then paste that into the "Sample" box in Power Automate to generate the schema.
I hope this helps!
Sandy
- JeanneDarcheJul 13, 2023Copper ContributorI tried with the SharePoint rest api, but the GET only returns 100 results. I have a few hundreds sites. Does using Microsoft Graph works around this problem?
- ganeshsanapJul 14, 2023MVP
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.
- M365Dev-ANSep 12, 2024Copper Contributor
ganeshsanap would you be able to help in how to get sites more than 5000? We may have more than 20k sites
- JeanneDarcheJul 13, 2023Copper ContributorThanks! Really apreciated!