Do not know how to solve the problem below
I cannot get a response from Microsoft Graph API. API works with some other requests.
I was following instructions from these pages https://learn.microsoft.com/en-us/graph/tutorials/dotnet-app-only?tabs=aad but cannot make my own requests.
App permissions that are given and confirmed by admin:
- Application.Read.All
- Chat.Read.All
- Chat.ReadBasic.All
- Chat.ReadWrite.All
- Group.Read.All
- User.Read.All
I get ids of users with:
_ = _appClient ??
throw new System.NullReferenceException("Graph has not been initialized for app-only auth");
var response = await _appClient.Users.GetAsync();
There are no exceptions, everything works (as I understand it must work).
And then try to get all the chats from Microft Teams of the user using his id:
var response = await _appClient.Users[id].Chats.GetAsync();
2
Answers
I figured out what type of error it was with the help of ODataError class:
Thanks)
@SergioMartin, Yes, the exception is misleading, you need to check the InnerException why you got into this state. Catch the exception on the call and check the inner exception. It could be a different reason. Also check the token with