Getting error while creating online meeting using graph api - azure

Here i am using Microsoft graph api for creating online meeting events but after generating toke when i am requesting to create an online meeting i am getting this error
{
"error": {
"code": "ResourceNotFound",
"message": "User not found",
"innerError": {
"date": "2021-09-01T17:54:57",
"request-id": "fa773652-e824-4c9e-af05-085e249fb489",
"client-request-id": "fa773652-e824-4c9e-af05-085e249fb489"
}
}
}
enter image description here

Based on the So thread reference,
Use Delegated permissions to create an onlineMeeting
You must log in as a user, and you cannot use the client credential flow. You need to use the auth code flow to obtain the token.
Ref link - Delegated Permission: https://learn.microsoft.com/en-us/graph/api/application-post-onlinemeetings?view=graph-rest-1.0&tabs=csharp
SO Reference: 404 error while creating Online Meeting using microsoft graph api c# without login into AzureActiveDirectory

Related

Issue Getting User Chats - Graph API

I am trying to get signed in user's chat messages in a B2C Tenant. I am getting 401 Unauthorized error. Tried the same with graph explorer which is also giving same error. I am using https://graph.microsoft.com/beta/me/chats endpoint. As per MSDN documentation, I have already given permissions to my Azure app. When I am trying this with a non B2C tenant, the API call succeeds.
Please help me with this issue. Error I am seeing is given below.
{
"error": {
"code": "Unauthorized",
"message": "Unauthorized",
"innerError": {
"date": "2021-06-24T15:30:29",
"request-id": "f2804d78-59d2-4917-ae2e-cb73b3eb0872",
"client-request-id": "52452dfc-cae9-d409-92b9-9e9586cab6c3"
}
}
}
With some research I found out that B2C tenants don't allow Teams at the first place. I have switched to a B2B tenant and it started working like a charm.

How to get a list of channels in Microsoft Teams using MS Graph?

I'm getting the user's token and submitting a request to /me/joinedTeams and get the teams IDs of the user.
For each team id, I want to get a list of available channels by sending a request to /teams/{id}/channels, however i am getting the following error:
{
"error": {
"code": "Forbidden",
"message": "Failed to execute Skype backend request GetThreadS2SRequest.",
"innerError": {
"date": "2021-03-12T07:08:38",
"request-id": "2f1b9408-e7db-4245-be6f-0ec6d67ff160",
"client-request-id": "2f1b9408-e7db-4245-be6f-0ec6d67ff160"
}
}
}
How do I fix this?
After which I want to send a request to /teams/{id}/channels and get drive-id.
And at the end, for each drive-id, get a list of files - /drives/{drive-id}/root/search(q='').
As I said in the comments, this api call does not support personal accounts, you must use a work account.
This is my test result:

Use MS Graph API and Postman to call Teams, Unsupported AAD Identity

I tried to create a call in Teams trough Microsoft Graph Api. I created a App with the given permissions but when i try to do the POST on: https://graph.microsoft.com/v1.0/communications/calls i get this error:
{
"error": {
"code": "UnknownError",
"message": "{\"errorCode\":\"7500\",\"message\":\"Unsupported AAD Identity.\",\"instanceAnnotations\":[]}",
"innerError": {
"date": "2020-11-11T14:38:43",
"request-id": "74ee843f-ba7e-4d87-b1e2-617c6fdce77c",
"client-request-id": "74ee843f-ba7e-4d87-b1e2-617c6fdce77c"
}
}
}
Token and everything looks good. If I change the token I get another error that this one is wrong.
To be honest my knowledge about Azure etc. is very low.
What Shiva said is right. You may have used a user token to call the API, so an error occurred. The API call currently only supports application tokens. You need to grant application permissions to the application and use the client credential flow to obtain Token.

Microsoft Graph REST API not able to write mail

I'm using graph rest api for writing a draft mail.
First, I called the authorize method with the https://graph.microsoft.com/.default scope:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=MY_CLIENT_ID&response_type=code&redirect_uri=https://login.microsoftonline.com/common/oauth2/nativeclient&response_mode=query&scope=https://graph.microsoft.com/.default
With the obtained code, I called the token method with the same scope:
https://login.microsoftonline.com/common/oauth2/v2.0/token
With this token, I am able to get messages without any issues, but when I try to create a draft by calling: https://graph.microsoft.com/v1.0/me/messages/ I get the following error:
{
"error": {
"code": "ErrorAccessDenied",
"message": "Access is denied. Check credentials and try again.",
"innerError": {
"request-id": "7fafbb5a-ab6d-4dbc-bb73-69d58b00f7ac",
"date": "2019-11-26T20:48:24"
}
}
}
As stated in the documentation (https://learn.microsoft.com/en-us/graph/api/user-post-messages?view=graph-rest-1.0&tabs=http) I have set the Mail.ReadWrite permission in my registered Azure app and granted admin consent. Am I missing something?
I checked Graph logs and that call to Microsoft Graph did not have the Mail.ReadWrite permission. Can you try adding that permission to the scope query param in your implicit auth flow call instead of .default? (If you need multiple permissions you can list them all in the scope param separated by spaces)

Unable to get response from Microsoft Graph API endpoint

I set up a new Application in microsoft azure and got the admin to consent application permissions for this app ( files.ReadWriteAll). I am able to get the access_token through POSTMAN. I am trying to get drive information using this endpoint
https://graph.microsoft.com/v1.0/drives/{drive-id}
But I get an error response :-
{ "error": { "code": "AccessDenied", "message": "Either scp or roles claim need to be present in the token.", "innerError": { "request-id": "905c7701-8b89-4711-9204-b00c4a09a921", "date": "2019-03-28T15:56:29" } } }
I used this link to get info on my access token.
http://jwt.calebb.net/
Files.Readwrite permissions don't seem to be listed anywhere in the info ( not sure why) . The azure site shows that consent was granted.
Azure permissions set up for my app:
Check the steps as below.
Register your app following this document, and Grant permissions.
get access token like this.
Check the token
Call graph api

Resources