Forum Discussion
Setting "Anyone" share link permissions on individual sites in Sharepoint
- Dec 14, 2017
- The script updates the setting only for existing sites.
- Correct.
Thanks for the reply Salvatore Biscari.
In the documentation you reference, there is a script that will "Updating the sharing setting for all sites in a tenant."
Two Questions, if I may:
1) Will this modify the sharing setting for all current and FUTURE sites, or would this need to be run again when new sites are created?
2) Just to be clear, the parameter ExternalUserAndGuestSharing is the one that will turn on anonymous sharing permissions (Anyone), correct?
Thanks again,
Ken
and continued thanks to Andrew Mueller
- The script updates the setting only for existing sites.
- Correct.
- Ken HardinDec 14, 2017Copper Contributor
Thanks!
- Ken HardinDec 29, 2017Copper Contributor
Salvatore Biscari Hello Again, Mr. Biscari:
I have attempted to run the Powershell script as directed (see attached for mods) and I get a bunch of red (I assume error) feedback from Powershell prior to the closing "External Sharing Capability updated for all sites." message displaying.
And, predictably, the Anyone Sharing setting has not changed in the Sharepoint interface.
Can you refer us to some source that can handle this task for a fee, etc.? Candidly, we never expected to have to suss out running a script to set a very basic permission such as File Sharing on what is marketed as a SaaS solution, and are simply out of out depth here, I am afraid.
I have attached our edits to the script, in case we have simply made some obvious blunder.
Thanks so much for all your help.
Ken
- Calvin JonesJun 05, 2018Copper Contributor
Ken Hardin Hello,
I was reviewing the error that you received. This is caused by not having the SharePoint Online Management Shell. If you follow this link
https://www.microsoft.com/en-us/download/details.aspx?id=35588 You can install the module which will then accept the Connect-SPOService cmdlet.
The below script is a modified variation of what is found on the previous site:
https://support.office.com/en-us/article/turn-external-sharing-on-or-off-for-sharepoint-online-6288296a-b6b7-4ea4-b4ed-c297bf833e30
- $userCredential = Get-Credential
- Connect-SPOService -Url https://TenantName-admin.sharepoint.com-admin.sharepoint.com -Credential $userCredential
- $sites = Get-SPOSite -Limit ALL -includepersonalsite:$true
- Foreach($site in $sites)
- {
- Set-SPOSite -Identity $site.Url -SharingCapability ExternalUserSharingOnly
- }
- Write-Host("External Sharing Capability updated for all sites.")
This script will need some modification from you.
- The URL section in line 2 will need to be changed to reflect the SharePoint Admin Center URL.
- The portion of line 6 "in italics" will need to be changed to reflect the sharing permission that you want to have enabled for all sites. The sharing permission can be found in the link mentioned above.
NOTE: The Script given will also update the sharing capability of all OneDrive sites as well. The script in the article does not. You can omit the OneDrive for Business from being updated by the script by changing the term in line 3 "-includepersonalsite:$true" from $true to $false.