Group creation for a site collection is causing threshold exception

Anantha Rengan Kannan 0 Reputation points
2024-10-16T10:57:03.1466667+00:00

Hi Everyone

We need to create around 9000 SharePoint groups in our site collection with specific names and custom permissions for each, currently we have a console app which will automate the group creation with custom permissions through CSOM, It is working well till the total group count reaches 5000, after that we are getting threshold issue like below

Microsoft.SharePoint.SPQueryThrottledException "The attempted operation is prohibited because it exceeds the list view threshold."

So we tried to create groups using PnP Powershell also like below

$Group = New-PnPGroup -Title $GroupName -ErrorAction Stop

Set-PnPGroupPermissions -Identity $GroupName -AddRole $Permission -Web $Web

There also we facing the same issue and getting error like below

Set-PnPGroupPermissions : The attempted operation is prohibited because it exceeds the list view threshold.

According to SharePoint documentation we can have up to 10000 groups per site collection please refer screenshot below

User's image

Kindly help us with workaround for this issue.

Microsoft 365 and Office | SharePoint | Development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Xyza Xue_MSFT 30,176 Reputation points Microsoft External Staff
    2024-10-17T02:29:52.32+00:00

    Hi @Anantha Rengan Kannan ,

    Thank you for posting in this community.

    Instead of creating all groups at once, try creating them in smaller batches. Maybe this can help you stay below the threshold during each operation.

    If this doesn't work, will trying to create the group manually work? Because according to my internal and external searches some users have previously reported that it is not possible to create content above the 5000 threshold using CSOM scripts or PnP PowerShell cmdlets. If manual creation works it means that new groups over 5000 can probably only be created manually, or try other languages to see if this works.


    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.


Your answer

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