Update Site Sharing Capability with Flow > How to use "admin.sp.com/_api/Tenant/Sites/Update"

Occasional Visitor

Hello everyone,

 

As admin, I need to update the sharing capability of a SharePoint site using Power Automate.

external-sharing-site

I have not figured out a way of doing this with Graph API so I am now trying with SharePoint REST API.

 

Using, "Send an HTTP request to SharePoint", I can read the current setting on https://mytenant-admin.sharepoint.com/_api/Microsoft.Online.SharePoint.TenantAdministration.Tenant/S... but I can't use the Update method with POST.

 

Does anyone know how to do this?

 

Thanks !

3 Replies

@alextest how about PUT or, probably better use PATCH? Please try on non-production first.

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
}

Matt_majedi_0-1623753864470.png