File.OpenBinaryDirect throws error Cannot invoke HTTP DAV request (SharePoint Client Object Model)
Problem :
Using
File.OpenBinaryDirect(context, serverRelative Url)
throws Error -
Cannot invoke HTTP DAV request (SharePoint Client Object Model)
Resolution :
Add a context.ExecuteQuery before the file.openbinarydirect line.
Example:
ClientContext context = new ClientContext("http://server:1234/site");
context.ExecuteQuery();
FileInformation info = File.OpenBinaryDirect(context, testuri.AbsolutePath);
testuri.AbsolutePath is equivalent to "site/libraryname/sample.xml"
0 comments