Nov 06 2020 04:50 AM
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
Nov 08 2020 06:35 PM - edited Nov 08 2020 06:35 PM
Any updates from any one from Microsoft?
Nov 22 2020 07:05 PM - edited Nov 22 2020 07:06 PM
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
Nov 23 2020 12:12 AM
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.
Reference: Get 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.
Nov 23 2020 12:27 AM
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.
Jul 12 2023 10:03 AM
Jul 12 2023 06:46 PM
Jul 12 2023 06:55 PM
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
Jul 13 2023 08:55 AM
Jul 13 2023 09:01 AM
Jul 14 2023 10:33 AM
Solution@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.
Jul 16 2023 08:44 AM
Jul 17 2023 08:51 AM
Jul 18 2023 03:49 AM
@JeanneDarche You can add ?$top=5000 after /items like:
_api/web/lists/getbytitle('DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECOLLECTIONS')/items?$top=5000
Please consider giving a Like if my post helped you in any way.
Jul 18 2023 07:31 AM
Jul 28 2023 02:40 AM
Hi @ganeshsanap
I am also doing the same task here, but i am doing from SPFX webpart
I can able to get any other lists or site contents , but not the because it through 403 status error
https://url-admin.sharepoint.com/_api/web/lists/GetByTitle('DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECOLLECTIONS')
Note: if I access the above URL in Browser then I can get response and required data.
Please help me how can i access the Site/Web sites list from tenant.
Actually I have Tenant admin permission.
but still it shows 403 error
Jul 28 2023 02:54 AM
@Muralikrishna1845 If above is not working for you, try using SharePoint Search or Microsoft Graph APIs:
Please consider giving a Like if my post helped you in any way.
Jul 28 2023 03:37 AM
Sep 12 2024 11:50 AM
@ganeshsanap would you be able to help in how to get sites more than 5000? We may have more than 20k sites
Jul 14 2023 10:33 AM
Solution@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.