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.

Getting Client Context from Sharepoint return null

See original GitHub issue

Hello, We are trying to migrate from PnPCore. We used the following code to get a Client Context

using ( var auth = new OfficeDevPnP.Core.AuthenticationManager() )
using ( var ctx = auth.GetWebLoginClientContext( "https://mycompany.sharepoint.com" ) )
{
    // Do something...
}

We tried to replace it by this code but the context returned is null

using ( var auth = new PnP.Framework.AuthenticationManager() )
using ( var ctx = auth.GetContext( "https://mycompany.sharepoint.com"  ) )
{
    // Do something...
}

Could you please advice?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
Dr-Olicommented, Sep 29, 2022

@DenisRouge : given the weblogin code cannot be compiled in .NET Standard 2.0 we can’t simply move it back from PowerShell into PnP Framework. We’re discussing whether we can make an additional PnP.Framework.WebLogin package, but in the short term your best solution will be copying the powershell implementation into your code base. See https://github.com/pnp/powershell/blob/4e8bc03ed3976c4bccb826da1f0892777f11fc6d/src/Commands/Utilities/BrowserHelper.cs for what to copy.

Hi @jansenbe,

was there any progress on PnP.Framework.WebLogin package? I would say that there will be probably a lot of people having issue to create app id.

Thx, Oliver

0reactions
jansenbecommented, Jan 12, 2021

Closing issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Client Context executeQuery() works in console app but ...
I have the function GetDocumentLibrary which must return a libray from sharepoint site. When I execute it from a Visual Studio Console ...
Read more >
Client Context is Coming as Null on the Host Web Remote ...
Here on the above code, the ClientContext will always be null. Hence, we are not able to proceed. For this, there is a...
Read more >
Trying to list users in a sharepoint application returns null
I'm trying to list all users in my sharepoint using graphAPI using this code snippet: this.context.msGraphClientFactory.
Read more >
Using Sharepoint CSOM, how to check for null when ...
How does one check if returned content type is found? ContentType cType = clientContext.Web.ContentTypes.GetById(contentType.Id); clientContext.
Read more >
Object reference not set Error - Using UiPathTeam. ...
Unfortunately, we then get this error message and the SharePoint Application Scope does not work because the Client Context is NULL:.
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