Skip to content

.Net Standard Authentication working but still unable to load projects in Project Online #5956

@snakex64

Description

@snakex64

Category

  • Question

Question

Not sure what I am not doing correctly. I followed the Using modern authentication with CSOM for .NET Standard documentation, but I still can't query the list of projects using the "ProjectContext".
The authentication seems be to working, I get a token but when I try to "Load" context.Projects it doesn't load anything :

using var context = new CSOMDemo.AuthenticationManager().GetContext(new Uri($"https://{company}.sharepoint.com/sites/pwa"), email, password);
context.Load(context.Projects);
context.ExecuteQuery();

var project = context.Projects.First(); // crash, Sequence contains no elements

If I do the same thing but using the .Net Framework with SharePointOnlineCredentials, the same url, username and password works.

The permissions in the application in azure seems to be configured correctly since if I remove the SharePoint> AllSites.FullControl and then try to run the same code, I get a ServerUnauthorizedAccessException at the ExecuteQuery line.

I changed the ClientContext for a ProjectContext in the Authentication.GetContext method.

Is this a bug or am I missing something ?

Thanks,

Environment details (development & target environment)

  • Your Developer Environment: Windows 10
  • Target Environment: SharePoint Online
  • Framework: .NET Core v3.1
  • Tooling: Visual Studio 2019

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:csom/rest/apiCategory: SharePoint Client Side Object Model SDK / REST APItype:archive-old-issueIssues which are closed as tool old for active worktype:questionQuestion... if answered, will be tagged as such.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions