The .netstandard version (used by core) of CSOM does not support on-premise sharepoint and standard security. It only supports azure authentication.
SharePoint CSOM ExecuteQuery throwing method missing exception
I have a class library project in .net framework which retrieve the list from the SharePoint using CSOM. Below is the code for it
using (Microsoft.SharePoint.Client.ClientContext spClientContext = new Microsoft.SharePoint.Client.ClientContext("url"))
{
spClientContext.Credentials = new NetworkCredential("Username", "password");
Web SpWeb = spClientContext.Web;
spClientContext.Load(SpWeb);
spClientContext.ExecuteQuery();
}
This code works fine when called from .net framework console application. I am trying to call this class library from the asp.net core web application. When its called, below exception is thrown in the ExecuteQuery
Method not found: 'Void System.Xml.XmlSecureResolver..ctor(System.Xml.XmlResolver, System.Security.PermissionSet)'
Any thoughts will be useful
3 answers
Sort by: Most helpful
-
-
Bruce (SqlWork.com) 64,396 Reputation points
2021-06-17T15:18:21.023+00:00 core can only call .net standard, not 4.* projects. you can not trick it by having an intermediate library call a 4.8 library.
as the .net standard version of CSOM does not support on-premise, If you need to access an on-premise sharepoint with .net core you must use the v1 REST api:
-
MichaelHan-MSFT 18,031 Reputation points
2021-06-18T06:21:14.167+00:00 Hi @Vaishali S ,
SharePoint On-Premises CSOM does not support .net core. Only .NET Framework is supported.
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
If the response is helpful, please click "Accept Answer" and upvote it.