Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

Sharepoint authentication issue from Azure function (.net Core) #1905

Open
venkeykanle opened this issue Jul 13, 2020 · 1 comment
Open

Sharepoint authentication issue from Azure function (.net Core) #1905

venkeykanle opened this issue Jul 13, 2020 · 1 comment

Comments

@venkeykanle
Copy link

Hi Team,

At the outset apologies, if this is not the right group to address the issue.

Issue:
Unable to authenticate the Sharepoint url from Azure function, while its works good in my local environment.
Here is the code-snippet.:

using Microsoft.SharePoint;
using Microsoft.SharePoint.Client;
using SharePointPnP;
/*
....
*/
string siteUrl = "https://abcd.sharepoint.com/xyz/abcd123";
string clientId = "aaaaa-bbbbb-ccccc-ddddd-eeeeeeeee";
string clientSecret = "lalalalalalalalalalalalalalalalalalall=";

var clientContext = new OfficeDevPnP.Core.AuthenticationManager().GetAppOnlyAuthenticatedContext(siteUrl, clientId, clientSecret);

The last line throws error..
Works good in local (.Net frame work 4.x) and but fails to authenticate in Azure function (.Net Core 2)

Is there any alternative PnP in Azure function on .Net Code2.1?
Would be great if someone throw lights on correct Assemblies to be used or some solution.

Thanks,
Venkatesh Kanale

@dnyaneshwar-surywanshi
Copy link

Hi I am also using same code and my targeted version is .Net Core 3.1 getting below error : The type initializer for 'OfficeDevPnP.Core.Utilities.TokenHelper' threw an exception.
---> System.TypeLoadException: Could not load type 'System.Web.Configuration.WebConfigurationManager' Please help me on this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants