Microsoft Graph Explorer / Microsoft Teams - 404 respond - microsoft-graph-api

when I'm trying to test ms teams api it always returns 404
For example - the simplest query: GET https://graph.microsoft.com/v1.0/me/joinedTeams
{
"error": {
"code": "ResourceNotFound",
"message": "Resource not found.",
"innerError": {
"date": "2020-07-24T08:47:53",
"request-id": "0ae3aa34-4aa5-4609-ac6b-01c2aba09b24"
}
}
}
I made test team, added couple of test users etc.

The problem was that I was using personal ms account instead of admin account from azure portal.

Related

Microsoft Graph GetChat API returns forbidden error for some chats

The GetChat API (https://graph.microsoft.com/v1.0/chats/{chatid}) from Microsoft Graph returns error 403 (Forbidden) for some chats when using application permissions. The application being used has Chat.Read.All permissions with admin consent granted. Also, the same application returns success for other chats.
Following are errors for couple of requests to get chat, that were tried using Postman:
1:
{
"error": {
"code": "Forbidden",
"message": "Forbidden",
"innerError": {
"date": "2021-10-18T13:16:26",
"request-id": "79c2ca6f-5b85-44ed-a3da-ef3607630a41",
"client-request-id": "79c2ca6f-5b85-44ed-a3da-ef3607630a41"
}
}
}
2:
{
"error": {
"code": "Forbidden",
"message": "Forbidden",
"innerError": {
"date": "2021-10-18T13:18:37",
"request-id": "5cfd4f22-8c25-4ecf-aa88-0c0c3df560d4",
"client-request-id": "5cfd4f22-8c25-4ecf-aa88-0c0c3df560d4"
}
}
}
You could try couple of things here -
Try the same API call in Graph explorer and observe if you still see this error. This will help in identifying if there is any issue with the token that you have generated.
You may have changed your API permissions after giving your application admin consent. When you give admin consent, Azure AD will take a "snapshot" of the permissions at the time of consent. Then if you change the permissions later, you will need to re-do the admin consent process again.
Personal accounts are not supported. Refer permissions here.

Getting Unknown error while accessing MS Graph API

I'm trying to get the chat messages from MS team channel using API.
https://graph.microsoft.com/v1.0/teams/{team-id}/channels/{channel-id}/messages
It works in graph explorer and returns the list of all chat messages. But when I hit the same API within Postman it return the following error:
I have consented all the required permission in azure app. What else am I missing here. Has anyone faced similar issues?
Please let me know.
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"date": "2021-04-20T04:01:46",
"request-id": "e32d3a2e-001c-4478-8c9c-8d5ff0c5e125",
"client-request-id": "e32d3a2e-001c-4478-8c9c-8d5ff0c5e125"
}
}
}
list channel messages is under protected API in MS teams. Before calling this API with application permissions, you must request access. To get the access you have to apply request access form

Graph Explorer - Get joined teams, post message to a channel etc always return Error 404,405

I am trying to use Microsoft Graph API's for sending messages to a team channel ( created a trial team account with my personal mail id) however I am getting errors for most the API calls.
Graph Explorer - https://developer.microsoft.com/en-us/graph/graph-explorer
GET - my profile - https://graph.microsoft.com/v1.0/me/
works
GET - my joined teams - https://graph.microsoft.com/v1.0/me/joinedTeams
fails with error 404
{
"error": {
"code": "ResourceNotFound",
"message": "Resource not found.",
"innerError": {
"date": "2020-12-06T10:37:20",
"request-id": "47590681-8fbd-4912-8bcd-c28fc982feb8",
"client-request-id": "f75c0df3-a3bc-c542-cd10-8f275bbdb685"
} } }
POST - send message to a channel - https://graph.microsoft.com/v1.0/teams/28be7684-0d3b-43cc-b709-eec08176554a/channels/19:76c3a65b63544382ba31ab5baa47521c#thread.tacv2/messages
Body
{
"body": {
"content": "Hello world"
}
}
Fails with error 405
I am not sure if it is because of my teams account ( selection option organization while set up ). I have done Modify permission -> Consent but some of them don't change to status consented.
Regards,
Sayantan

"Unknown Error" in Microsoft Graph Explorer

I'm using the Microsoft Graph Explorer on the Microsoft Planner (formerly Tasks) API.
I can requests users fine, e.g. /beta/users.
But when I try to access my plans using /beta/me/plans or /beta/plans/{ID}, I get an unknown error with the details below:
Status Code: 403
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"request-id": "62299f57-1792-4b0c-8b60-8613c54f4f50",
"date": "2017-01-17T21:12:51"
}
}
}
I'm trying to query the tasks on a plan that I own.
This API has changed. This URL should be
GET https://graph.microsoft.com/v1.0/me/planner/plans

Microsoft graph api orgContacts addition scopes?

At this moment I'm working with the personal contacts. But I want to expirment with the Organizational contacts but when I try to do a request to https://graph.microsoft.com/beta/contacts I got this response
{
"error": {
"code": "Authorization_RequestDenied",
"message": "Insufficient privileges to complete the operation.",
"innerError": {
"request-id": "882e70df-d89c-4d9a-a028-cd3ad2e497cb",
"date": "2016-04-13T09:14:21"
}
}
I suspect that I'm missing a persmission scope but the documentation isn't showing any requiered scopes(created a issue for that https://github.com/OfficeDev/microsoft-graph-docs/issues/24.) Does anyone else has expirence with the Organizational contacts
The scope that's needed at present is Directory.Read.All. We are still working out what scope will be required when we move from beta to v1.0.

Resources