May 8th, 2023

Streamline your SharePoint experience with the new Microsoft Graph SharePoint Admin API

We are excited to announce the release of the Microsoft Graph SharePoint Admin API, which provides a powerful way for developers to interact with SharePoint and OneDrive tenant-level settings. This API enables you to update various settings, such as file sharing capabilities, site creation options, and more, all through a simple and intuitive interface.

Let’s explore some of the key features of the Microsoft Graph SharePoint Admin API and how to leverage them to enhance your SharePoint experience.

Update SharePoint and OneDrive tenant-level settings

The SharePoint Admin API on Microsoft Graph allows you to update one or more tenant-level settings for SharePoint and OneDrive. This includes settings such as:

  • Allowed domain GUIDs for the OneDrive sync app
  • Deleted user personal site retention period in days
  • Excluded file extensions for the OneDrive sync app
  • Image tagging options for the tenant
  • Legacy authentication protocol settings
  • Site storage limit options
  • Sync button visibility on personal sites
  • And many more

To update these settings, you can use the PATCH /admin/sharepoint/settings HTTP request. This request requires the SharePointTenantSettings.ReadWrite.All permission and the user to belong to either the Global Administrator or SharePoint Administrator role.

Manage sharing capabilities and domain restrictions

The Microsoft Graph SharePoint Admin API enables you to manage sharing capabilities and domain restrictions for your tenant. You can control the sharing capability for the tenant by setting the sharingCapability property to one of the following values:

  • disabled: Users can share only with people in the organization. No external sharing is allowed.
  • externalUserSharingOnly: Users can share with new and existing guests. Guests must sign in or provide a verification code.
  • externalUserAndGuestSharing: Users can share with anyone by using links that don’t require sign-in.
  • existingExternalUserSharingOnly: Users can share with existing guests (those already in the directory of the organization).

Additionally, you can specify the external sharing mode for domains by setting the sharingDomainRestrictionMode property to one of the following values:

  • none: No restrictions apply.
  • allowList: Users will be able to share with external collaborators coming only from the list of allowed email domains.
  • blockList: Users will be able to share with all external collaborators apart from the ones on the list of blocked email domains.

Example: Updating tenant-level settings

Here’s an example of how to update tenant-level settings using the Microsoft Graph SharePoint Admin API:

PATCH https://graph.microsoft.com/v1.0/admin/sharepoint/settings   
Content-Type: application/json   
Content-length: 1323   
{   
    "deletedUserPersonalSiteRetentionPeriodInDays": 365,   
    "excludedFileExtensionsForSyncApp": [".mp3"],   
    "imageTaggingOption": "enhanced",   
    "isLegacyAuthProtocolsEnabled": true,   
    "isSitesStorageLimitAutomatic": false,   
    "isSyncButtonHiddenOnPersonalSite": false,   
    "isUnmanagedSyncAppForTenantRestricted": false,   
    "personalSiteDefaultStorageLimitInMB": 120000   
}   

This request updates various settings, such as the retention period for deleted user personal sites, excluded file extensions for the OneDrive sync app, and the default storage limit for personal sites.

Conclusion

The SharePoint Admin API on Microsoft Graph offers a powerful way to manage and update tenant-level settings for SharePoint and OneDrive. By leveraging this API, you can enhance your SharePoint experience and gain greater control over your organization’s settings.

To learn more about the Microsoft Graph SharePoint Admin API and how to use it, please check out our documentation. And visit our Microsoft Graph Dev Center.

Happy coding!

0 comments

Discussion are closed.