2

Using the .NET csom I am trying to retrieve the File that I just uploaded to sharepoint in order to check it in.

Here is the code I am using to upload the file to sharepoint

using (var stream = new MemoryStream(excel_file))
{
   Microsoft.SharePoint.Client.File.SaveBinaryDirect(context,relative_url,stream,true);
}

I can see the file in the document library just fine when I view the sharepoint site in a browser. The file is checked out so I need to also check it in at this time.

I am using this code to try to get the File object so that I can check it in

var file = web.GetFileByServerRelativeUrl(relative_url);
context.Load(file);
context.ExecuteQuery();

However an exception is thrown when it reaches the context.ExecuteQuery(); line with the error: "Field or property \"EffectiveInformationRightsManagementSettings\" does not exist.

What I have tried to resolve the issue:

  • Changing the context.Load(file) statement to context.Load(file, f => f.EffectiveInformationRightsManagementSettings);
1

The error occurs because the CSOM SDK that is being used is not compatible with the SharePoint server version. In this exact case I was using SDK version 16 when I should have been using version 15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy