Sharepoint Client Missing Method

Viewed 2387

I want to connect to my sharepoint site and get a specific list. I found the official docs and tried this:

ClientContext ctx = new ClientContext("https://factionxyz0.sharepoint.com/sites/faktion-devs");
Web web = ctx.Web;
List fileList = web.Lists.GetByTitle("TestLijst MicrosoftFlow");
CamlQuery query = CamlQuery.CreateAllItemsQuery(100);
ListItemCollection items = fileList.GetItems(query);
ctx.Load(items);
try
{
    ctx.ExecuteQuery();
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message);
    Console.WriteLine(ex.InnerException);
    return req.CreateErrorResponse(HttpStatusCode.BadRequest, ex);
} 

but this just gives me the following error:

Method not found: 'Void System.Xml.XmlSecureResolver..ctor(System.Xml.XmlResolver, System.Security.PermissionSet)'.

I don't understand why or what is triggering this exception (I'm running this as an Azure Function)

Microsoft.SharePoint.Client package version: 14.0.4762.1000

Console Output: Console Output

1 Answers

If you are using SharePoint Online Tenant, please download and install SharePoint Online CSOM Library here:

SharePoint Online Client Components SDK

The version should be 16.0.xxxx.xxxx, 14.0.xxxx.xxxx is used in SharePoint 2010. Once installed the library, you can find the Microsoft.SharePoint.Client.dll and Client.RunTime.dll in this folder:

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI

Here is a sample to use SharePoint Online CSOM inside Azure Function to connection List Item for your reference:

How To Create Azure Function App To Delete SharePoint Online List Using CSOM

Related