Accessing SharePoint using OfficeDevPnP fails the first time

%3CLINGO-SUB%20id%3D%22lingo-sub-808166%22%20slang%3D%22en-US%22%3EAccessing%20SharePoint%20using%20OfficeDevPnP%20fails%20the%20first%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-808166%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20first%20time%20after%20SharePoint%20is%20started%20the%20first%20call%20to%20ClientContext.ExecuteQuery()%20(in%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fprevious-versions%2Foffice%2Fsharepoint-server%2Fee544361%2528v%253doffice.15%2529%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EMicrosoft.SharePoint.Client%3C%2FA%3Enamespace)%20using%20the%20OfficeDevPnP.Core%20library%20with%20SharePoint%20fails.%20I%20am%20using%20CertificateMixed%20authentication%2C%20so%20the%20call%20fails%20during%20the%20FedAuthCookie%20request.%20If%20I%20retry%20the%20call%20to%20Execute%20query%20it%20works%20OK.%20Is%20there%20a%20better%20workaround%20to%20this%20or%20should%20I%20just%20deal%20with%20the%20fact%20that%20occasionally%20it%20will%20fail%20on%20the%20first%20go%3F%20The%20ExecuteQueryRetry()%20extension%20method%20doesn't%20catch%20this%20particular%20failure%20because%20the%20exception%20is%20not%20one%20of%20the%20specific%20exceptions%20it%20catches.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-808166%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPnP%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Occasional Visitor

The first time after SharePoint is started the first call to ClientContext.ExecuteQuery() (in the Microsoft.SharePoint.Client namespace) using the OfficeDevPnP.Core library with SharePoint fails. I am using CertificateMixed authentication, so the call fails during the FedAuthCookie request. If I retry the call to Execute query it works OK. Is there a better workaround to this or should I just deal with the fact that occasionally it will fail on the first go? The ExecuteQueryRetry() extension method doesn't catch this particular failure because the exception is not one of the specific exceptions it catches.

 

Thanks.

0 Replies