Sep 24 2020 02:22 PM - edited Sep 24 2020 02:23 PM
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
Dec 06 2020 10:02 AM
The method you are trying to use is available in OfficeDevPnP.Core. You can install it from here.
Microsoft documentation: AuthenticationManager.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.
Apr 04 2022 10:25 PM
When you provided a constructor for your class that takes arguments, the compiler no longer creates an empty constructor. Therefore, you cannot call an empty constructor because it does not exist. You would need to explicitly write the constructor that takes 0 arguments in your class's code. The constructor of the inheritance class needs to construct the base class first. since the base class does not have a default constructor (taking 0 arguments) and you are not using the non-default constructor you have now, this won't work. so either:
Or