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:
Kindly help us with workaround for this issue.