'AuthenticationManager' does not contain a constructor that takes 0 arguments

%3CLINGO-SUB%20id%3D%22lingo-sub-1710732%22%20slang%3D%22en-US%22%3E'AuthenticationManager'%20does%20not%20contain%20a%20constructor%20that%20takes%200%20arguments%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1710732%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20the%20following%20code%20to%20connect%20to%20SharePoint%20using%20clientID%20and%20ClientSecret%3A-%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%20%20%20%20string%20siteUrl%20%3D%20%22https%3A%2F%2F****l.sharepoint.com%2Fsites%2FDocumentApprovalProcess%2F%22%3B%0A%20%20%20%20string%20clientId%20%3D%20%22***%22%3B%0A%20%20%20%20string%20clientSecret%20%3D%20%22**%22%3B%0A%20%20%20%20%0A%20%20%20%20using%20(var%20context%20%3D%20new%20AuthenticationManager().GetAppOnlyAuthenticatedContext(siteUrl%2C%20clientId%2C%20clientSecret))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ebut%20i%20am%20getting%20this%20error%3A-%3C%2FP%3E%3CP%3E%3CSTRONG%3E'AuthenticationManager'%20does%20not%20contain%20a%20constructor%20that%20takes%200%20arguments%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1710732%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1960559%22%20slang%3D%22en-US%22%3ERe%3A%20'AuthenticationManager'%20does%20not%20contain%20a%20constructor%20that%20takes%200%20arguments%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1960559%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F233354%22%20target%3D%22_blank%22%3E%40john%20john%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThe%20method%20you%20are%20trying%20to%20use%20is%20available%20in%20OfficeDevPnP.Core.%20You%20can%20install%20it%20from%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.nuget.org%2Fpackages%2FSharePointPnPCoreOnline%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EMicrosoft%20documentation%3C%2FSTRONG%3E%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fdotnet%2Fapi%2Fofficedevpnp.core.authenticationmanager.getapponlyauthenticatedcontext%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EAuthenticationManager.GetAppOnlyAuthenticatedContext%20Method%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20check%20below%20reference%20to%20check%20how%20you%20can%20use%20this%20method%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.c-sharpcorner.com%2Farticle%2Fconnect-to-sharepoint-online-site-with-app-only-authentication%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EConnect%20To%20SharePoint%20Online%20Site%20With%20App%20Only%20Authentication%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CHR%20%2F%3E%3CP%3EPlease%20click%20%3CSTRONG%3EMark%20as%20Best%20Response%3C%2FSTRONG%3E%20if%20my%20post%20helped%20you%20to%20solve%20your%20issue.%20This%20will%20help%20others%20to%20find%20the%20correct%20solution%20easily.%20It%20also%20closes%20the%20item.%20If%20the%20post%20was%20useful%20in%20other%20ways%2C%20please%20consider%20giving%20it%20%3CSTRONG%3ELike%3C%2FSTRONG%3E.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Valued Contributor

I have the following code to connect to SharePoint using clientID and ClientSecret:-

 

    string siteUrl = "https://****l.sharepoint.com/sites/DocumentApprovalProcess/";
    string clientId = "***";
    string clientSecret = "**";
    
    using (var context = new AuthenticationManager().GetAppOnlyAuthenticatedContext(siteUrl, clientId, clientSecret))

 

 

but i am getting this error:-

'AuthenticationManager' does not contain a constructor that takes 0 arguments

1 Reply

@john john 

 

The method you are trying to use is available in OfficeDevPnP.Core. You can install it from here.

 

Microsoft documentationAuthenticationManager.GetAppOnlyAuthenticatedContext Method 

 

You can check below reference to check how you can use this method:

Connect To SharePoint Online Site With App Only Authentication 


Please click Mark as Best Response if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.