How to reduce the unique scopes count with Graph API to prevent reaching "uniqueScopesExceeded" limit?

Dmitry Belyakov 0 Reputation points
2025-06-24T06:37:07.5433333+00:00

We're using Microsoft Graph .NET library to manage Office365 integration.

Recently our users started to get the "uniqueScopesExceeded" error, when requesting anonymous links to view files: "You cannot break inheritance for this item because there are too many items with unique permissions in this list".

We create anonymous links for files using the library:

await graphServiceClient
    .Users[app.ServiceAccountUserId]
    .Drives[app.DriveId]
    .Items[itemId]
    .CreateLink("view", "anonymous")
    .Request()
    .PostAsync(cancellationToken);

I tried removing permissions for the old files, thinking it might reduce the unique scopes, but I'm not sure it helps, because when viewing the files on OneDrive it still says "This file has unique permissions", even after I delete the permissions (apart from "owner")

await graphServiceClient
    .Users[app.ServiceAccountUserId]
    .Drives[app.DriveId]
    .Items[itemId]
    .Permissions[permissionId]
    .Request()
    .DeleteAsync(cancellationToken);

I know there's a "resetroleinheritance" endpoint of the SharePoint API, but our project is built around Graph and I'm not sure we can access the SharePoint API with the access that we have

My questions are:

  1. Does removing permissions with Graph API have any effect on unique scopes, or am I right and it doesn't help?
  2. Is there anything I can do to reduce the unique scopes with Graph API?

For now our solution was to just manually move a bulk of old files to another document library, but we're trying to find a proper permanent solution to this

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.