Share via

Unable to create public sharing links - “uniqueScopesExceeded” error

Saurav Setia 0 Reputation points
2025-12-16T05:37:34.9966667+00:00

I’m using Microsoft Graph API as part of an internal integration to generate anonymous public sharing links for files stored in OneDrive Online.

We are making the request with the following details:

{

  "method": "POST",

  "endpoint": "https://graph.microsoft.com/v1.0/users/{UserName}/drive/items/{ItemID}/createLink",

  "headers": {

    "Authorization": "Bearer (access_token)”,

    "Content-Type": "application/json",

    "Accept": "application/json"

  },

  "body": {

    "type": "view",

    "scope": "anonymous"

  }

}

When calling the createLink API using the above parameters, we consistently receive the following error:

{

  "error": {

    "code": "notSupported",

    "message": "You cannot break inheritance for this item because there are too many items with unique permissions in this list.",

    "innerError": {

      "code": "uniqueScopesExceeded",

      "date": "2025-12-15T09:56:15",

      "request-id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",

      "client-request-id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

    }

  }

}

This issue is preventing me from generating anonymous public sharing links through Graph API.

I would like to understand:

Why this limit is being enforced at the API level

Whether there are any supported workarounds or recommended approaches for generating public links at scale

If folder-level sharing or alternative Graph patterns are recommended to avoid this error

Any guidance or clarification would be appreciated.

Microsoft 365 and Office | OneDrive | For business | Other
0 comments No comments

2 answers

Sort by: Most helpful
  1. Kha-N 8,260 Reputation points Microsoft External Staff Moderator
    2025-12-16T06:56:20.6566667+00:00

    Hi @Sauravsetia,

    Welcome to Microsoft Q&A, and thank you for reaching out to us.

    Based on your description, as I checked, according to Microsoft’s official documentation, OneDrive for Business and SharePoint Online enforce a strict limit on the number of items in a document library that can have unique permissions. The maximum limit is 50,000 unique permission scopes, while the recommended operational limit is 5,000 for best performance.

    User's image

    Creating an anonymous (“Anyone with the link”) sharing link breaks permission inheritance, causing the item to receive its own unique permission scope. As more items accumulate their own scopes, the library approaches this limit.

    This behavior suggests the error you see is not a Microsoft Graph API limitation. It is a SharePoint Online platform-level restriction, and Graph merely surfaces the underlying SharePoint error. For large libraries, Microsoft recommends keeping unique permissions to an absolute minimum unless required by a specific business scenario.

    For workarounds, using folder‑level sharing that Q&A assist suggest is the best place to start. When you share at the folder level, inheritance is broken only once, meaning the folder creates a single unique scope while all files inside continue to inherit its permissions. This prevents additional unique permission scopes from being created each time you need to share something.

    If your library has already accumulated too many unique scopes, you may also consider creating a new OneDrive or SharePoint site and distributing your content across multiple libraries to avoid hitting the limit again.

    Another option is to use the Download URL provided by Microsoft Graph. Since this URL is temporary and doesn’t modify permissions, it avoids generating new unique scopes entirely, though it may not be appropriate if you need a persistent public link.

    For more details, you can refer to this Microsoft documentation here. There is also a helpful Stack Overflow thread explanation that breaks the concept down in simpler terms.

    User's image

    This link will take you to StackOverFlow, which is outside Microsoft’s domain. Please note that Microsoft is not responsible for the accuracy, security, or advertising on external sites.

    I hope this helps.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".     

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Q&A Assist
    2025-12-16T05:37:51.76+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The error you are encountering, uniqueScopesExceeded, indicates that the item you are trying to create a sharing link for has reached the limit of unique permissions that can be applied to items within a SharePoint or OneDrive library. This limit is enforced to maintain performance and manageability within the system, as having too many unique permissions can complicate permission management and increase the overhead for the system.

    Workarounds and Recommendations:

    1. Review Permissions: Check the permissions of the items in the library. If there are items with unique permissions that are no longer needed, consider removing those unique permissions to reduce the count.
    2. Folder-Level Sharing: Instead of sharing individual files, consider sharing at the folder level. By sharing a folder, you can set permissions for all items within that folder, which can help avoid hitting the unique permissions limit.
    3. Batch Processing: If you need to create multiple links, consider batching your requests or creating links for a smaller number of items at a time to manage the unique permissions more effectively.
    4. Use of Inheritance: Ensure that items inherit permissions from their parent folder when possible. This can help keep the number of unique permissions lower.
    5. Alternative Patterns: If you frequently need to create public links, evaluate whether restructuring your items into fewer libraries or folders with broader permissions could be beneficial.

    These strategies should help you manage the unique permissions limit and allow you to generate public sharing links more effectively.


    References:

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.