0

I've found the following link on msdn and I've been struggeling to get it running. I had to use Microsoft.SharePoint.Client.dll from 16 hive (I'm using SharePoint 2013 server) inside Visual Studio to get no compile error. After running the following code, I got a "Method not found" exception:

        var clientContext = new ClientContext("http://myserver");

        var fileGuid = new Guid("D51C440B-4F52-4005-90BE-BDC42E850975");
        var file = clientContext.Web.GetFileById(fileGuid);

        clientContext.Load(file);
        clientContext.ExecuteQuery();

Please help me on what I'm doing wrong.

Andreas
  • 294
  • 1
  • 14

1 Answers1

1

Web.GetFileById is supported only on SharePoint online. See: https://msdn.microsoft.com/EN-US/library/microsoft.sharepoint.client.web.getfilebyid.aspx

You say you are using SharePoint Server 2013; the API support is different. (Microsoft.SharePoint.Client.dll version 15.0 is for SharePoint Server 2013; version 16.0 is for SharePoint online. API support varies between each version).

B.C.
  • 83
  • 1
  • 8