InternalServerError when accessing image/sticker and code snippet urls in chat messages returned from Graph Api - microsoft-graph-api

I received "InternalServerError" when accessing an image/sticker/code-snippet link in a chat message return from Microsoft Graph Api.
I received the following chat message from Graph Api (not all properties are not listed):
{
"body": {
"contentType": "html",
"content": "<div><div><img alt=\"Sticker image, OH YEAH!\" src=\"https://graph.microsoft.com/beta/teams/2bf9ebf9-8c85-474a-818a-793bc8898757/channels/19:accc034188164562b194965de5f72d3b#thread.skype/messages/1561440945248/hostedContents/aWQ9eF8wLXNhLWQ4LTUxMTExNzY5OWQ4ZTg3YjgwMWUyMDA0ODVlODRkYThmLHR5cGU9MSx1cmw9aHR0cHM6Ly9hcy1hcGkuYXNtLnNreXBlLmNvbS92MS9vYmplY3RzLzAtc2EtZDgtNTExMTE3Njk5ZDhlODdiODAxZTIwMDQ4NWU4NGRhOGYvdmlld3MvaW1nbw==/$value\" style=\"width:334px; height:250px\"><img alt=\"Sticker image, WORKS ON MY MACHINE\" src=\"https://graph.microsoft.com/beta/teams/2bf9ebf9-8c85-474a-818a-793bc8898757/channels/19:accc034188164562b194965de5f72d3b#thread.skype/messages/1561440945248/hostedContents/aWQ9eF8wLXNhLWQ4LTNlYzQxOTFhYjYxODE5NTI1N2Y1YmVmOGI5YjdiY2JmLHR5cGU9MSx1cmw9aHR0cHM6Ly9hcy1hcGkuYXNtLnNreXBlLmNvbS92MS9vYmplY3RzLzAtc2EtZDgtM2VjNDE5MWFiNjE4MTk1MjU3ZjViZWY4YjliN2JjYmYvdmlld3MvaW1nbw==/$value\" style=\"width:375px; height:250px\"></div>\n\n\n</div>"
},
}
Then I tried to access the image link
GET https://graph.microsoft.com/beta/teams/2bf9ebf9-8c85-474a-818a-793bc8898757/channels/19:accc034188164562b194965de5f72d3b#thread.skype/messages/1561440945248/hostedContents/aWQ9eF8wLXNhLWQ4LTUxMTExNzY5OWQ4ZTg3YjgwMWUyMDA0ODVlODRkYThmLHR5cGU9MSx1cmw9aHR0cHM6Ly9hcy1hcGkuYXNtLnNreXBlLmNvbS92MS9vYmplY3RzLzAtc2EtZDgtNTExMTE3Njk5ZDhlODdiODAxZTIwMDQ4NWU4NGRhOGYvdmlld3MvaW1nbw==/$value
Headers:
Authorization: bearer [access_token]
The response was:
500 Internal Server Error
{
"error": {
"code": "InternalServerError",
"message": "Failed to process request.",
"innerError": {
"request-id": "83da292c-f982-44d3-ae07-ce8b10910b65",
"date": "2019-06-25T08:09:35"
}
}
}
Headers:
request-id: 83da292c-f982-44d3-ae07-ce8b10910b65
client-request-id: 83da292c-f982-44d3-ae07-ce8b10910b65
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"Southeast Asia","Slice":"SliceC","Ring":"2","ScaleUnit":"000","RoleInstance":"AGSFE_IN_7","ADSiteName":"SEA"}}
Date: Tue, 25 Jun 2019 08:09:34 GMT
There are 2 images in the chat message. Accessing the other image incurred the same error.
However, if the chat message had only one image, the link worked. If the chat message had more than one images, or more specifically, more than one links to https://graph.microsoft.com/beta/teams/[group_id]/channels/[channel_id]/messages/[message_id]/hostedContents/[content_id]/$value, should it be an image or a code snippet, accessing the links returned me InternalServerError.
Can someone help?

Related

error message AadGroupCreationLimitExceeded when using CreateTeam graph API endpoint in Power Automate

I'm using Graph API Create Team endpoint. When I've tested the flow it run successfully, but on the next run I get the following error message:
{ "error": {
"code": "BadRequest",
"message": "Failed to execute Templates backend request CreateTeamFromTemplateRequest. Request Url:
https://teams.microsoft.com/fabric/emea/templates/api/team, Request
Method: POST, Response Status Code: BadRequest, Response Headers:
Strict-Transport-Security: max-age=2592000\r\nx-operationid:
cc9dc27f2daa4a40ae5f6ef6b445951e\r\nx-telemetryid:
00-cc9dc27f2daa4a40ae5f6ef6b445951e-40032a234fdf1740-00\r\nX-MSEdge-Ref: Ref A: B7C2163BAF2D4C6D9A8CA7314163BDF4 Ref B: DB3EDGE2617 Ref C:
2022-07-13T13:09:47Z\r\nDate: Wed, 13 Jul 2022 13:09:47 GMT\r\n,
ErrorMessage : {"errors":[{"message":"Error when calling Middle
Tier. Message: ''. Error code: 'AadGroupCreationLimitExceeded'. Status
code:
BadRequest.","errorCode":"Unknown"}],"operationId":"cc9dc27f2daa4a40ae5f6ef6b445951e"}",
"innerError": {
"message": "Failed to execute Templates backend request CreateTeamFromTemplateRequest. Request Url:
https://teams.microsoft.com/fabric/emea/templates/api/team, Request
Method: POST, Response Status Code: BadRequest, Response Headers:
Strict-Transport-Security: max-age=2592000\r\nx-operationid:
cc9dc27f2daa4a40ae5f6ef6b445951e\r\nx-telemetryid:
00-cc9dc27f2daa4a40ae5f6ef6b445951e-40032a234fdf1740-00\r\nX-MSEdge-Ref: Ref A: B7C2163BAF2D4C6D9A8CA7314163BDF4 Ref B: DB3EDGE2617 Ref C:
2022-07-13T13:09:47Z\r\nDate: Wed, 13 Jul 2022 13:09:47 GMT\r\n,
ErrorMessage : {"errors":[{"message":"Error when calling Middle
Tier. Message: ''. Error code: 'AadGroupCreationLimitExceeded'. Status
code:
BadRequest.","errorCode":"Unknown"}],"operationId":"cc9dc27f2daa4a40ae5f6ef6b445951e"}",
"code": "BadRequest",
"innerError": {},
"date": "2022-07-13T13:09:48",
"request-id": "9e717d71-db05-4a84-a7e0-ef61c027146f",
"client-request-id": "9e717d71-db05-4a84-a7e0-ef61c027146f"
} } }
Anyone knows what AadGroupCreationLimitExceedederror means, and how to solve this?
FYI: I don't have 5,000 groups in Azure to reach the Azure AD organization limit.
Are you creating new teams on behalf of a user or as application? If you are creating new teams on behalf of a user, there is a limit of 250 directory objects/user.
See here.

Create Team, 400 Bad Request, Required functionality is not supported

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.

Forbidden when accessing image/sticker urls in chat messages returned from Graph Api

I received "Forbidden" when accessing an image/sticker link in a chat message return from Microsoft Graph Api.
I received the following chat message from Graph Api (not all properties are not listed):
{
"body": {
"contentType": "html",
"content": "<div><div>Message 499\n<div><span><img src=\"https://graph.microsoft.com/beta/teams/82d87df3-b8bd-4bdc-9090-5f8666b32134/channels/19:baf66ad0b75f4656bf20ff5667fae565#thread.skype/messages/1562258187781/hostedContents/aWQ9eF8wLWN1cy1kOC0xYjlkYTQ2NzA1ZTI5YjA5N2QzMDgyZjc2ODZiYTlhMSx0eXBlPTEsdXJsPWh0dHBzOi8vdXMtYXBpLmFzbS5za3lwZS5jb20vdjEvb2JqZWN0cy8wLWN1cy1kOC0xYjlkYTQ2NzA1ZTI5YjA5N2QzMDgyZjc2ODZiYTlhMS92aWV3cy9pbWdv/$value\" width=\"250\" height=\"250\" style=\"vertical-align:bottom; width:250px; height:250px\"></span>\n\n</div>\n\n\n</div>\n</div>"
}
}
Then I tried to access the image link
GET https://graph.microsoft.com/beta/teams/82d87df3-b8bd-4bdc-9090-5f8666b32134/channels/19:baf66ad0b75f4656bf20ff5667fae565#thread.skype/messages/1562258187781/hostedContents/aWQ9eF8wLWN1cy1kOC0xYjlkYTQ2NzA1ZTI5YjA5N2QzMDgyZjc2ODZiYTlhMSx0eXBlPTEsdXJsPWh0dHBzOi8vdXMtYXBpLmFzbS5za3lwZS5jb20vdjEvb2JqZWN0cy8wLWN1cy1kOC0xYjlkYTQ2NzA1ZTI5YjA5N2QzMDgyZjc2ODZiYTlhMS92aWV3cy9pbWdv/$value
Headers:
Authorization: bearer [access_token]
The response was:
403 Forbidden
{
"error": {
"code": "Forbidden",
"message": "Forbidden",
"innerError": {
"request-id": "3143682e-4dd2-4057-ad83-e4d7fbf32b98",
"date": "2019-07-05T07:09:06"
}
}
}
Headers:
request-id: 3143682e-4dd2-4057-ad83-e4d7fbf32b98
client-request-id: 3143682e-4dd2-4057-ad83-e4d7fbf32b98
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"Southeast Asia","Slice":"SliceC","Ring":"3","ScaleUnit":"001","RoleInstance":"AGSFE_IN_2","ADSiteName":"SEA"}}
Date: Fri, 05 Jul 2019 07:09:05 GMT
However, I was able to list the hosted contents of the same channel:
GET: https://graph.microsoft.com/beta/teams/82d87df3-b8bd-4bdc-9090-5f8666b32134/channels/19:baf66ad0b75f4656bf20ff5667fae565#thread.skype/messages/1562258187781/hostedContents
Headers:
Authorization: bearer [access_token]
Response
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#teams('82d87df3-b8bd-4bdc-9090-5f8666b32134')/channels('19%3Abaf66ad0b75f4656bf20ff5667fae565%40thread.skype')/messages('1562258187781')/hostedContents",
"#odata.count": 1,
"value": [
{
"id": "aWQ9eF8wLWN1cy1kOC0xYjlkYTQ2NzA1ZTI5YjA5N2QzMDgyZjc2ODZiYTlhMSx0eXBlPTEsdXJsPWh0dHBzOi8vdXMtYXBpLmFzbS5za3lwZS5jb20vdjEvb2JqZWN0cy8wLWN1cy1kOC0xYjlkYTQ2NzA1ZTI5YjA5N2QzMDgyZjc2ODZiYTlhMS92aWV3cy9pbWdv"
}
]
}
Also, I was able to retrieve the image from another chat message in another channel (the general channel) in the same team.
GET https://graph.microsoft.com/beta/teams/82d87df3-b8bd-4bdc-9090-5f8666b32134/channels/19:db70de74054944fe9dbce0a592eddb6d#thread.skype/messages/1562252008138/hostedContents/aWQ9eF8wLWN1cy1kNi1iYWY0OTc0ZGNjMjc0MTAwMjI5YmMyZjcyY2Y0ODk2NSx0eXBlPTEsdXJsPWh0dHBzOi8vdXMtYXBpLmFzbS5za3lwZS5jb20vdjEvb2JqZWN0cy8wLWN1cy1kNi1iYWY0OTc0ZGNjMjc0MTAwMjI5YmMyZjcyY2Y0ODk2NS92aWV3cy9pbWdv/$value
Headers:
Authorization: bearer [access_token]
The user associated with the access token is one of the owners of the team, but he is not the one posting the chat message containing the image.
What am I missing here?
Update: I did more testing and found the following pattern.
The issue did not happen for General channel.
For other channels, if a user had not posted any message to a channel, accessing the image link of the chat messages resulted in Forbidden error. After the user posted one message, it could access the link fine.
Looks like a permission synchronization issue. Any idea?

InternalServerError Object reference not set to an instance of an object when creating an open extension using Microsoft Graph Api

I received "InternalServerError", "Object reference not set to an instance of an object." when creating an open extension for a group.
I tried to create an open extension for a group:
POST https://graph.microsoft.com/v1.0/groups/[group id]/extensions
{
"#odata.type" : "microsoft.graph.openTypeExtension",
"extensionName": "com.test.1235",
"watermarks": "abc",
"id": "com.test.1235"
}
Headers:
Authorization: bearer [access token]
Content-Type: application/json
This is the response I received:
500 Internal Server Error
{
"error": {
"code": "InternalServerError",
"message": "Object reference not set to an instance of an object.",
"innerError": {
"request-id": "56d5fd05-cf69-4a91-85b6-dcfce7894e13",
"date": "2019-06-17T10:52:44"
}
}
}
Headers:
request-id: 56d5fd05-cf69-4a91-85b6-dcfce7894e13
client-request-id: 56d5fd05-cf69-4a91-85b6-dcfce7894e13
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"Southeast Asia","Slice":"SliceC","Ring":"2","ScaleUnit":"000","RoleInstance":"AGSFE_IN_5","ADSiteName":"SEA"}}
Date: Mon, 17 Jun 2019 10:52:44 GMT
This did not just happen for groups. Creating an extension for a user also returned the same error. Given the "Object reference not set to an instance of an object." message I assume there is a bug somewhere in the backend. Otherwise please let me know how to fix the request to avoid this error.
We're rolling back to the previous Graph deployment while we investigate and root cause the issue. The issue should be mitigated shortly and then API requests to create open extensions should be working again. Thank you for reporting this!

Microsoft.Graph.createLink: 400 Version not specified

I'm trying to create a sharing link for OneDrive item using Microsoft.Graph.CreateLink action:
POST https://graph.microsoft.com/v1.0/me/drive/items/01B642VZR4QM6MX36HGZELNLHCFGY26JJ6/Microsoft.Graph.createLink HTTP/1.1
Authorization: Bearer {access_token}
Content-Type: application/json
{
"type":"edit"
}
and I got the following error:
HTTP/1.1 400 Bad Request
{
"error": {
"code": "BadRequest",
"message": "Version not specified.",
"innerError": {
"request-id": "3ca90464-3910-49e1-92f2-3a9daa822944",
"date": "2016-02-17T15:56:16"
}
}
}
Either method description or metadata does not contain any information about versions needed other than in the API endpoint.
From logs corresponding to request-id:3ca90464-3910-49e1-92f2-3a9daa822944, the request received by the service was "POST https://graph.microsoft.com/". The lack of path segment in the request URL is causing this expected error. Can you please check the request again?

Resources