Forum Discussion
shocko
Nov 04, 2022Iron Contributor
Automate SharePoint Online Organizational Settings
I wish to automate various aspects of Sharepoint Online including site level but also organization level settings like external sharing etc. I don't see how to do this with the Graph REST API nor the Sharepoint Online CMDLETS. Anyone give a steer on how to achieve this?
7 Replies
- SvenSieverdingBronze ContributorYou could use "Microsoft 365 Desired State Configuration" for that
# Getting client credential $Credential = Get-Credential # Exporting resources using credentials Export-M365DSCConfiguration -Components @("SPOAccessControlSettings", "SPOApp", "SPOBrowserIdleSignout", "SPOHomeSite", "SPOHubSite", "SPOOrgAssetsLibrary", "SPOPropertyBag", "SPOSearchManagedProperty", "SPOSearchResultSource", "SPOSharingSettings", "SPOSite", "SPOSiteAuditSettings", "SPOSiteDesign", "SPOSiteDesignRights", "SPOSiteGroup", "SPOSiteScript", "SPOStorageEntity", "SPOTenantCdnEnabled", "SPOTenantCdnPolicy", "SPOTenantSettings", "SPOTheme", "SPOUserProfileProperty") -Credential $Credential
- shockoIron ContributorWhat API is it using for this?
- SvenSieverdingBronze Contributor
Internally they use the "Get-PnPTenant" Command from PnP Powershell.
I am not 100% sure, but I assume they are using the CSOM Library in that command
https://github.com/pnp/powershell/blob/dev/src/Commands/Admin/GetTenant.cs
- You could simply set the org-level and then control all containers (sites, groups and teams) with sensitivity labels for containers, which include sharing level and default sharing links etc.
https://learn.microsoft.com/en-us/microsoft-365/compliance/sensitivity-labels-teams-groups-sites?view=o365-worldwide- shockoIron ContributorSet as in manually? I'm looking to automate.
- Isn’t much work to toggle the org-wide setting once is it? Haven’t used Graph for adding labels to containers but there’s PowerShell too.