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.
Category
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 :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 aServerUnauthorizedAccessException
at theExecuteQuery
line.I changed the
ClientContext
for aProjectContext
in theAuthentication.GetContext
method.Is this a bug or am I missing something ?
Thanks,
Environment details (development & target environment)