question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question - Forbidden error when trying to OpenBinaryStream

See original GitHub issue

Hello,

2 weeks ago I asked about how to reproduce Weblogin Method that was in the old PnPLivrary (Issue #79). You send us a workaround using some classes from PnP Powershell. I’m trying to load a file using OpenBinaryStream but when we access to the file we received an error “Forbidden”

Have you an idea of what can can be done in order to make it work?

Thank you

using ( var ctx = GetWebLoginClientContext( "https://my.sharepoint.com", true ) )
{
	var fi = ctx.Web.GetFileByServerRelativeUrl( "/teams/Demo/Test.xlsx" );

	ctx.Load( fi );
	ctx.ExecuteQuery(); // System.Net.WebException: The remote server returned an error: (403) Forbidden.

	fi.OpenBinaryStream();
	ctx.ExecuteQuery();
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
DenisRougecommented, Jan 29, 2021

I will investigate about these 2 calls and keep you informed.

0reactions
jansenbecommented, Feb 3, 2021

Fiddler was shared with custom code that, after fixing, works in my lab. Also worked to load a web title for @DenisRouge , so closing this issue here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't Open Binary Stream of file on Sharepoint Documents
1 Answer. Solution: Use OpenBinary Instead. "The problem was stemming from the use of the Microsoft. SharePoint.
Read more >
OpenBinaryStream does not exist SharePoint file ...
The code is working fine SharePoint online file and getting the error Method "OpenBinaryStream" does not exist for the SharePoint 2010 ...
Read more >
What Is the 403 Forbidden Error and How to Fix It (8 ...
You might encounter the 403 forbidden error when you visit an empty website directory or a specific page that has a permission error....
Read more >
c# - Sharepoint error: OpenBinaryStream throws an error
The program returns an error at the ExecuteQuery() and tells me that there is no OpenBinaryStream() method. I tried to swap the two...
Read more >
How to Fix a 403 Forbidden Error on Your Site
The 403 Forbidden error indicates that the server understands the request but can't provide additional access. This means that the web page you' ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found