We have SharePoint 2013 configured for Permissive on certain file types. We are pulling back files in a document library and displaying them in a MVC view. When user click on these files we now need to open them in the browser. We are storing the FileRef
in our database so we can use the following to get the file:
var file = clientContext.Web.GetFileByServerRelativeUrl(fileRef);
This works fine. But I now need to be able to open this file in the browser. If we click on this file in SharePoint it opens in the browser. OpenBinaryDirect does not work (as research as showed me that it requires the token) so I have tried OpenBinaryStream.
How do I now open this stream as a document?