
it is better to use ExecuteQueryRetry from OfficeDevPnP Core which was designed to avoid throttling issues.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello! I have 3 services in my company. All services work with one service account and sometime I catch error:
The remote server returned an error: (429). Stack: at System.Net.HttpWebRequest.GetResponse() at Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute() at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb) at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery() at DD.ProjectApproval.Model.SPListItemExtensions.GetFieldUserValueNew(ListItem item, String fieldName, ClientContext clientContext).
I read microsoft recomendations, but I undurstend about
e.WebRequestExecutor.WebRequest.UserAgent = "NONISV|Contoso|GovernanceCheck/1.0";
GovernanceCheck - Enterprice app name, Do I only have to register new app in Enterprice App or need to configure it else?
Contoso -name of Company, where I can find name in Azure?
it is better to use ExecuteQueryRetry from OfficeDevPnP Core which was designed to avoid throttling issues.
You should switch over to use Client ID + Certificate/Secret from username/password. This will be more secure and should also help (but may not eliminate, depending on what you're doing, stamp health, etc.) avoid 429 responses.
Hi @Nerobov Andrey ,
Please refer the official document below to use e.WebRequestExecutor.WebRequest.UserAgent for avoid throttling:
Avoid getting throttled or blocked in SharePoint Online
Also you can build a extension method ExecuteQueryWithIncrementalRetry also like official document for handling 429 throttling issue.
Thanks
Best Regards
If an Answer is helpful, please click "Accept Answer" and upvote it.
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.
@Jerryzy-MSFT thanks. but I am already it : using (var ctx = new ClientContext(new Uri(Consts.PortalUrl, UriKind.Absolute)))
{
log.Info(Environment.UserDomainName);
log.Info(Consts.getMailIP);
var creds = new NetworkCredential(Autorization.UserEmail, Autorization.Password);
ctx.Credentials = new SharePointOnlineCredentials(creds.UserName, creds.SecurePassword);
ctx.ExecutingWebRequest += delegate (object sender, WebRequestEventArgs e)
{
e.WebRequestExecutor.WebRequest.UserAgent = $"NONISV|Digdes|{Consts.AppSettings.Name}/1.0";
};
}
but it don't help me. Probably, is UserAgent wrong? How check it?
I used the UserAgent "NONISV|Contoso|GovernanceCheck/1.0", it's working per the test:
But as you have met the 429 error in your environment, you should firstly wait for 429 recovery, then use the UserAgent for avoiding the issue.