-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
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