Forum Discussion
Update Site Sharing Capability with Flow > How to use "admin.sp.com/_api/Tenant/Sites/Update"
In case someone looking for a solution, this is how I manage to solve this:
you need to use admin API, the URL of the admin API is
https://{tenant name}-admin.sharepoint.com/
you will need the site ID of the site that you want to change the sharing setting.
in your power automate add a new 'Send HTTP request to SharePoint'
Site address: https://{tenant name}-admin.sharepoint.com/
Method: Post
Uri: _api/Microsoft.Online.SharePoint.TenantAdministration.Tenant/Sites('{Site ID}')
Headers:
- accept : application/json;odata=verbose
- content-type: application/json;odata=verbose
- X-HTTP-Method: MERGE
Body:
{
"__metadata": {
"type": "Microsoft.Online.SharePoint.TenantAdministration.SiteProperties"
},
"SharingCapability": 1
}
- OmarSeriMar 15, 2023Copper Contributor
Hi,
https://{tenant}-admin.sharepoint.com/ not accepted as "Site Address" on "Send an HTTP request to Sharepoint"
Error: We are unable to find the site address. Please try selecting a site address from the dropdown.
- ganeshsanapMar 16, 2023MVP
OmarSeri Replace {tenant} in URL with the actual name of your tenant where you are creating the flow. For example:
https://contoso-admin.sharepoint.com
And add it as a custom value like:
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.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs
- hemanth1595Jul 12, 2023Copper Contributor
ganeshsanap
I am facing the following error , any idea with,{"status": 403,"message": "Attempted to perform an unauthorized operation.\r\nclientRequestId: 662df67a-2e53-45a0-b2ab-634addd3905a\r\nserviceRequestId: bca1c5a0-b02c-2000-7833-e0b461d0e560","source": "https://xxxxxxxx-admin.sharepoint.com/_api/Microsoft.Online.SharePoint.TenantAdministration.Tenant/Sites('54287e2f-2b7e-443f-bcc8-9427949b63f9')","errors": ["-2147024891","System.UnauthorizedAccessException"]}connection account has sharepoint admin role, this flow is triggered from the power app, and the users running the power app doesn't have admin role. I think user doesn't require admin role as I have already have a connection to that action.
- AysaniOct 08, 2021Copper ContributorThank you for sharing! great find!