5

I am trying to do.

Microsoft.SharePoint.Client.File.OpenBinaryDirect(context,relativeUrl)

Always get "forbidden" and unauthorized.

However If i use same context and url to do web.getFileByServerRelativeUrl() it works as expected.

That assures me, it should not be context or url issue.

Has anyone encountered this before?

5

According to SharePoint 2013 Online App: 403 Response While Downloading Documents from a Document Library article this error occurs when using oAuth App authentication model since Microsoft.SharePoint.Client.File.OpenBinaryDirect method doesn't pass App token

The solution is to use Microsoft.SharePoint.Client.File.OpenBinaryStream method instead as demonstrated in the same article.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.