sendMail Intermittent Errors - microsoft-graph-api

I'm sending messages using the Microsoft Graph REST API. My application is a service/daemon application where I am sending email on a users behalf. I am using the sendMail API (POST /users/{user id}/sendMail ) and this works a very large percentage of the time. The problem is that every so often the following error is returned:
{ "error": { "code": "UnknownError", "message": "", "innerError": { "request-id": "a901d503-8acf-47e7-8f7e-a20311aa0e3b", "date": "2017-01-10T15:06:48" } }}
Any idea what is causing this error and is there a workaround?

The logs show that you're getting a 429 status code (which means throttling).
Is your app sending many requests for the same resource/user? If so, the error docs say this:
Client application has been throttled and should not attempt to repeat the request until an amount of time has elapsed.

Related

"Unknown Error" in Microsoft Graph API Get Staff Availability in MS Bookings

When trying to make a request to the graph API endpoint for getting staff availability info on MS Bookings I keep receiving the below error which returns status code 500. I had followed the guide here and also decoded my access token and verified I had the right permissions.
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"date": "2022-07-25T08:21:46",
"request-id": "aa302590-9a6e-47a4-a5ac-51a12ef5e72e",
"client-request-id": "aa302590-9a6e-47a4-a5ac-51a12ef5e72e"
}
}
}
I also encountered the same error in graph explorer.
Well this seemed to work for me when I changed the timeZone value on the request payload from my local time zone to 'UTC'. So my request payload was changed as below
However same error persists on graph explorer - guessing its because application permissions are not currently supported on graph explorer

Unknown Error when sending/replying to message on MS Teams using Graph API

I am trying to send a message or reply to a message using Graph APIs for MS Teams. I have the correct permissions set and also have access to Protected APIs (if thats a concern).
The APIs I use to send messages are for both channel and 1:1 chat message.
POST URL Request:
https://graph.microsoft.com/beta/chats/{chat-id}/messages/{message-id}/replies
https://graph.microsoft.com/beta/chats/{chat-id}/messages/
https://graph.microsoft.com/beta/users/{user-id}/chats/{chat-id}/messages/
https://graph.microsoft.com/beta/teams/{team-id}/channels/{channel-id}/messages/{message-id}/replies
https://graph.microsoft.com/beta/teams/{team-id}/channels/{channel-id}/messages
Permissions set are ChannelMessage.Send, Group.ReadWrite.All, ChatMessage.Send for both delegated and application level.
I use a 2-step process to authorize the client /authorize and then /adminconsent.
When trying to post message I always get "UnknownError" and empty message with 401 status code.
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"date": "2020-07-10T04:58:06",
"request-id": "ff58128b-585b-4242-99c4-011c8e537d94"
}
}
}
Is this some issue with my app or from MS graph side?
Issue was with the access token. Using app-only permissions to send message is not supported.
Ref: https://github.com/microsoftgraph/microsoft-graph-docs/issues/8998

Why are we suddenly getting 403 on graph calls to list a team's channels?

We do run the GET call:
https://graph.microsoft.com/v1.0/teams/711fc163-0408-4649-9a30-af65a5d30b52/channels
It used to return the channels just fine, but this week it suddenly starting failing with this error:
{
"error": {
"code": "AccessDenied",
"message": "Failed to execute Skype backend request GetThreadsS2SRequest.",
"innerError": {
"request-id": "226d8e17-fa0f-4c42-8139-4776e198a3b2",
"date": "2019-08-26T19:25:10"
}
}
}
We see that the problem is happening for different teams and across different tenants. This is critical!
Thanks for reporting this issue. There was an issue going on with List Channel Graph API which has been fixed now.

504 Gateway Timeout (UnknownError) when trying to track changes in a user's calendar

For our internal application we synchronize our user's calendars (in our Office 365 tenant) with a local "cache" in our database. We're using the new Delta Queries in Microsoft Graph to do track these changes.
Most of the calendars synchronize correctly, but for some reason there is one single calendar where we consistently hit a 504 Gateway Timeout error when attempting to request the events using the nextLink received from the first request.
First request:
GET https://graph.microsoft.com/v1.0/users/<userId>/calendars/<calendarId>/calendarView/delta?startDateTime=2017-06-10t00%3A00%3A00Z&endDateTime=2018-06-10t00%3A00%3A00Z
First response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(event)",
"#odata.nextLink": "https://graph.microsoft.com/v1.0/users/<userId>/calendars/<calendarId>/calendarView/delta?$skiptoken=R0usmcdvmMuZCBYV0hguCGmIJqcU0n_6jVFWUlNKbXkBKYVlxLSMsISZI5sLLLJyLJF8hZIj0PURpAeP_XxydW_qbMUoFMTXjOpLa8Ta6rxMRA7Wv6IHYfjyLPcDzCbM_hKvTgq8BZaBeJv-a61mebF6X2wT4HqCAGL5lL4nLZabHk1nD9GbWJ0a4Qq0M41_GPYxEi5YNe9u1673SQ1Djw.F85xXB6GjtO7myCQCOgFvzp1G7mQB0BvuHQJyn0CICQ",
"value": [
<list of events>
]
}
Second request:
GET https://graph.microsoft.com/v1.0/users/<userId>/calendars/<calendarId>/calendarView/delta?$skiptoken=R0usmcdvmMuZCBYV0hguCGmIJqcU0n_6jVFWUlNKbXkBKYVlxLSMsISZI5sLLLJyLJF8hZIj0PURpAeP_XxydW_qbMUoFMTXjOpLa8Ta6rxMRA7Wv6IHYfjyLPcDzCbM_hKvTgq8BZaBeJv-a61mebF6X2wT4HqCAGL5lL4nLZabHk1nD9GbWJ0a4Qq0M41_GPYxEi5YNe9u1673SQ1Djw.F85xXB6GjtO7myCQCOgFvzp1G7mQB0BvuHQJyn0CICQ
Second response:
504 Gateway Timeout
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"request-id": "0784cffb-cba7-424b-be1d-74b2bfef5da1",
"date": "2017-07-10T09:11:33"
}
}
}
I've tried executing the script a few times over the last week, but the request consistently fails when using requesting the second page. Other calendars synchronize with no issues, so I don't really know how to debug these kind of issues. Is there anything we can do to resolve this issue?
I'm working with the team that owns Calendar sync to check where the latency in the stack is causing this time out. I'll post as soon as they have root caused this. I may need more info on what is special about this one Calendar encountering this issue.
Thanks,
Sri

GraphApi API error codes

I am attempting to create a interface between our web application and the GraphApi.
I am currently struggling to handle error correctly as the documentation for graph API seems to be at best incomplete. Is there a reference to full list of errors one should expect.
An example of the issue is where I make a request after my access token has expired. The error code is not on the list (graph.microsoft.io docs/overview/errors page) and in a different format (capitalization). It also seems to vary drastically from the azure error codes such as "Request_BadRequest". This was found in an MSDN article titled "Error codes and error handling | Graph API concepts".
The document states "You may use the information returned here instead of, or in addition to the HTTP status code returned.". However, this is really hard if they are changing despite being out of beta.
example of an error response body:
{ "error": {
"code": "InvalidAuthenticationToken",
"message": "Access token has expired.",
"innerError": {
"request-id": "267438d2-4cc5-4621-9307-2af26d2f5b49",
"date": "2016-02-16T13:30:24"
}
}
}

Resources