pnp/PnP

Remove or actualize ExecuteQueryWithIncrementalRetry sample in documentation

antonkhrit opened this issue · 0 comments

####Which PnP repository should you use to report the issue?####

Category

[x ] Bug
[ ] Enhancement

Environment

[ x] Office 365 / SharePoint Online
[ x] SharePoint 2016
[x ] SharePoint 2013

Expected or Desired Behavior

The sample from this article isn't working:
https://github.com/pnp/PnP/tree/dev/Samples/Core.Throttling#handling-the-throttling-in-the-code

The implementation for ExecuteQueryWithIncrementalRetry should look like in official documentation:
https://docs.microsoft.com/en-us/sharepoint/dev/general-development/how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online

Observed Behavior

Your article confuses people because they use it in their code and it is not really protecting from SharePoint throttling. It loses ClientContext request after getting 503 errors. It means it sends an empty request next time. This request is successful and code thinks that everything is okay but the required request was never executed.

At the same time implementation in PnP.Core is correct:
https://github.com/pnp/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/Extensions/ClientContextExtensions.cs

Thus, I suggest you remove this confusing article and just redirect people to the official page:
https://docs.microsoft.com/en-us/sharepoint/dev/general-development/how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online

Steps to Reproduce

Take implementation from the example and test it with overloaded SharePoint that is throwing 503 errors. Try to load some property or field using ClientContext.Load. Once you got the 503 error, your request will be retried but the property that you just loaded will never be available to your code.