I have an Active Directory sync app which is using for internal purpose and its saving the data to SQL table feeding from Azure AD via Graph API. Along with its basic functionality, we are updating custom user profile properties using CSOM. But most of the time after some request processing, we are getting Error 429, Too many requests.
Is there any option of bulk update to update a set of (say 500/1000 profile) custom user profile properties in a single request? Please help me on this. If there is any other option, please suggest.
Thanks in advance.
Cause:
When a user exceeds usage limits or request frequency limits, SharePoint Online throttles any further requests from that user account for a short period.For requests including CSOM or REST calls, SharePoint Online returns HTTP status code 429 ("Too many requests") or 503 ("Server Too Busy") and the requests will fail.
Possible work arounds:
Make sure your app in azure ad has
Sites.FullControl.AllandUser.ReadWrite.Allpermission scopes and grant admin consent . Also check the same in xml for FullControl in app permissions.Try to select only those user profile properties that you need in the request and avoid which are not necessary.
Use JSON batching to combine multiple requests into a single batch request.
Try using
ExecuteQueryAsync()instead of ExecuteQuery() or vice versa or ExecuteQueryWithIncrementalRetry . Optional: try to use ExecuteQuery calls with Start-Sleep -Milliseconds 1000 statements, especially if calling it in a loop.Otherwise please try with these powershell module references:
Other references: