Create Team, 400 Bad Request, Required functionality is not supported - microsoft-graph-api

I'm trying to create a Microsoft Teams team in Migration mode via the Graph API. However I get a 400 response that I can't figure out. The query is shared in the link below.
Shared Query
For those that don't want to view it that way, here is my request:
POST https://graph.microsoft.com/beta/teams
Authorization: Bearer ...
Content-Type: application/json
{
"#microsoft.graph.teamCreationMode": "migration",
"template#odata.bind": "https://graph.microsoft.com/beta/teamsTemplates(\u0027standard\u0027)",
"displayName": "SlackMigrationTest",
"description": "testing slack migrations",
"createdDateTime": "2021-01-14T00:00:00.000Z"
}
I created this based on the microsoft doc here.
The reponse I get is:
The remote server returned an error: (400) Bad Request.
{
"error": {
"code": "BadRequest",
"message": "Required functionality is not supported.",
"innerError": {
"date": "2021-01-20T15:51:21",
"request-id": "dc4189cf-db4a-4a60-a271-f63b5d759a05",
"client-request-id": "dc4189cf-db4a-4a60-a271-f63b5d759a05"
}
}
}
I'm sure its something obvious that I'm missing but any help would be greatly appreciated.

Here you are using the User Context token and trying to make the call. This API call only works in Application context as shown in the below screenshot.
So use Client Credential flow and set Application permissions and then make a call.
As you can see below, it worked for me with App token.
You cannot test it in graph explorer because the Graph Explorer gets user token.

Related

Microsoft Graph API: UnknownError when i am trying to get a call

I am trying to get the subject (ex. Maths 1) of an online TEAMS meeting via Microsoft Graph API.
When i send a request to https://graph.microsoft.com/v1.0/communications/callRecords/8f4477a7-f5b2-40ed-a165-95519825c9cg in the response there is no value for the subject of the meeting.
So my next move is to send a request to https://graph.microsoft.com/v1.0/communications/calls/8f4477a7-f5b2-40ed-a165-95519825c9cg because the Graph API documentation has the property 'subject' in the response. When i send this request i get this response:
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"date": "2021-02-10T12:32:19",
"request-id": "9a81a114-8a58-457b-929v-390bda79669g",
"client-request-id": "9a81a114-8a58-457b-929a-490bda79669g"
}
}
}
with a response status code : 500 Interval Server Error from the Graph API.
I have tried this request with different meeting ids but the result is the same.
My API permissions are these:
API Permissions
I would appreciate it if I had a solution to my problem or some other way to find the subject of the meeting.
The reason why you are getting that error is because you are querying the teams meeting as a resource of type 'call' instead of 'event'.
Please use GET https://graph.microsoft.com/v1.0/users/{id |userPrincipalName}/events/{id} using Calendars.Read Application permission when querying as an application or GET https://graph.microsoft.com/v1.0/me/calendar/events/{id} with the Calendars.Read delegated permissions when querying as a signed-in user.
For further reference, have a look at https://learn.microsoft.com/en-us/graph/api/event-get?view=graph-rest-1.0&tabs=http

Teams listChannel Graph API resulting in "Unauthorized error - "Failed to execute Aad backend request GetUsersByObjectIdsRequest"

The teams list channel Graph API has started throw Unauthorized error as below. It use to work fine until yesterday. We are using "ServicePrincipal" for authentication and it has all necessary graph permission. In this case - Group.Read.All
Sample endpoint we are using is as below.
https://graph.microsoft.com/v1.0/teams/dccde580-0fc5-11eb-adc1-0242ac120002/channels.
Since this morning, it is failing continuously with the below error. More over, this is not a beta API.
As per our analysis, it is failing for those teams which has a private channel it. But as per documentation, private channels should be returned in the response as well. I dont understand what could be the issue.
Any idea / hints /help in this regard is really appreciated.
{
"error": {
"code": "Unauthorized",
"message": "Failed to execute Aad backend request GetUsersByObjectIdsRequest. Workload Unknown. Request Url: https://graph.windows.net/myorganization/getObjectsByObjectIds?api-version=1.61-internal, Request Method: POST, Response Status Code: Unauthorized, Response Headers: ocp-aad-diagnostics-server-name: 0yK5pQbb6mmQTig21hH07WmGI0k2nuTime8Zw4wMO7k=\r\nrequest-id: c33c655e-27f7-4f96-aabf-70e6d9d8770d\r\nclient-request-id: 5bd775a7-7dba-4ad7-bc9a-fbd91ae46fea\r\nStrict-Transport-Security: max-age=31536000; includeSubDomains\r\nDate: Fri, 16 Oct 2020 15:23:45 GMT\r\n, Reason Phrase: Unauthorized",
"innerError": {
"date": "2020-10-16T15:23:45",
"request-id": "3f3793b8-02d6-4653-a14f-3e455660e3d8",
"client-request-id": "3f3793b8-02d6-4653-a14f-3e455660e3d8"
}
}
}
We are facing the same issue, and the error exist in some of our test tenants and it will thrown by microsoft when we using the application permission to make the request.
The requests with the delegate permission token work without any issue.
Microsoft adds some Permissons.
https://learn.microsoft.com/de-de/graph/api/channel-list?view=graph-rest-beta&tabs=http
Do you have the application permissons?
Do you use the beta endpoint?
Look at this: https://learn.microsoft.com/de-de/microsoftteams/platform/graph-api/rsc/resource-specific-consent

Microsoft Graph Calendar API - TargetIdShouldNotBeMeOrWhitespace error

We use Microsoft Graph API's to create a calendar in outlook
Following is the HTTP Request
POST https://graph.microsoft.com/v1.0/users/me/calendars
Content-type: application/json
{
"name": "My Calendar"
}
It was working for the last 2 years. Suddenly it is throwing an error as
{
"error": {
"code": "TargetIdShouldNotBeMeOrWhitespace",
"message": "Id is malformed.",
"innerError": {
"request-id": "78bce863-d6fb-4ea9-b0f8-e5097010cef6",
"date": "2019-03-23T11:54:34"
}
}
}
When we searched the documentation (https://learn.microsoft.com/en-us/graph/api/user-post-calendars?view=graph-rest-1.0).
We found the API URL has been changed
When was a critical update like this was rolled out which caused breakage in our flows?
Is there any official channel/group notifying these changes.
similar question for mail API's Microsoft Graph API - SendMail http 400 - API url from documentation not working
The correct URI is /me, not /users/me. Behind the scenes, /me is just an alias for /users/{id}. Asking for /users/me would be the equivalent of asking for /users/users/me.
It sounds like you were making use of an unintended behavior. It stopped working when that behavior was corrected.

When listing children of folder I get error 501 The request is not supported by the system

If I want to list files in the folder with query parameter $orderBy according to the documentation, I get a response with error 501.
Here is a raw example of request:
GET /v1.0/drives/{id}/items/{id}/children?$select=name,id,folder,lastModifiedDateTime,createdDateTime,size,createdBy,lastModifiedBy,webUrl&$orderby=createdDateTime HTTP/1.1
Host: graph.microsoft.com
Authorization: Bearer <token>
The response is:
{
"error": {
"code": "notSupported",
"message": "The request is not supported by the system.",
"innerError": {
"request-id": "c925ae56-8359-4e8f-98b9-92ff0c4dfc8a",
"date": "2018-06-04T10:50:00"
}
}
}
This problem I have only with a specific OneDrive account. If I use the same API call for a different drive and folder, then it works well without any problem.
When I investigated it then it seemed like the API doesn't support parameter $orderBy with date variable inside for this account at all.
Does anyone know why I get this error for a specific account?

Microsoft Graph SharePoint access items (read/write)

I am attempting to create a new list item in SharePoint Online using the [beta] Microsoft Graph endpoint. The goal is to call Microsoft Graph from an Outlook Add-in but the problem persists on Postman.
When I call the endpoint as per the documentation I get the following error message:
{
"error": {
"code": "unauthenticated",
"message": "The caller is not authenticated.",
"innerError": {
"request-id": "bb094f39-71c9-4c7d-9d9b-913cc9622baf",
"date": "2017-08-08T11:32:02"
}
}
}
I'm using ADAL JS to fetch the authentication token and I initialized my AuthenticationContext with my tenantID. My app has the following permissions: offline_access, Sites.Read.All, Sites.ReadWrite.All, User.Read
2nd Edit - more details on readItem
I use the https://graph.microsoft.com/beta/sites/{site-id}/lists/{list-id}/items endpoint with the {site-id} of my desired site from /sites and the {list-id} of the list from /sites/{site-id}/lists but this is the empty response I get:
{
"#odata.context": "https://graph.microsoft.com/...",
"value": []
}
If I try to to add /{item-id} to my original call to access specific item I receive this response:
{
"error": {
"code": "itemNotFound",
"message": "The specified list was not found",
"innerError": {
"request-id": "6e7ccae3-3aee-4dbb-ae3e-de61250478e0",
"date": "2017-08-09T13:13:33"
}
}
}
Which doesn't make sense because I can retrieve valid information about the list if i make the call without /items/..
Any and all input appreciated :) I'll gladly provide more code, this is all I deemed relevant and didn't want to overcrowd the post.
might be that you actually don't have an item with that id, since https://graph.microsoft.com/beta/sites/{site-id}/lists/{list-id}/items/1 works for me.
test the id's you really have by just https://graph.microsoft.com/beta/sites/{site-id}/lists/{list-id}/items and each item returns it's id.

Resources