Does anyone know what to do when you get "UnknownError" from Graph API?
Request: https://graph.microsoft.com/v1.0/users/[USER_ID]/messages?$select=id,receivedDateTime&$filter=receivedDateTime+ge+2016-09-13+and+receivedDateTime+lt+2019-09-14&$orderby=receivedDateTime+asc&$skip=25651&$top=1
Response:
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"request-id": "1ea27a29-5491-44d2-824a-0aaee9280c40",
"date": "2019-09-13T19:48:30"
}
}
}
Microsoft Graph is also more secure and resilient than Azure AD Graph. For this reason, Azure AD Graph has been on a deprecation path since June 30, 2020, and will be retired in the near future as we move all investments to Microsoft Graph.
I'm having the same error on another part of the Graph API. I'm lead to believe it's a permissions error, easiest way to test would most likely be to use the Graph Explorer.
https://developer.microsoft.com/en-us/graph/graph-explorer
Run the request there and assign yourself the relevant permissions.
If this doesn't work then the relevant place to raise this issue seems to be on the Graph API GitHub which is here https://github.com/microsoftgraph/microsoft-graph-docs
The HTTP error code would give you much more detail about what went wrong. If it's a 403 or 401, then it's an auth error. If it's 500, or 503, then it's a server error.
I am getting the error more often now, on an application that retrieves file and folder stucture. My workaround is to detect the error, wait a little and retry.
IDriveItemChildrenCollectionPage folderitems = null;
bool done = false;
Int16 tries = 0;
while (!done && tries < 3)
{
try
{
DriveItem folderitem = null;
if (folder.Equals(""))
folderitem = SPclient.Sites[siteId].Lists[listId].Drive.Root.Request().GetAsync().Result;
else
folderitem = SPclient.Sites[siteId].Lists[listId].Drive.Root.ItemWithPath(folder).Request().GetAsync().Result;
folderitems = SPclient.Sites[siteId].Lists[listId].Drive.Items[folderitem.Id].Children.Request().GetAsync().Result;
done = true;
}
catch (Exception ex)
{
if (ex.InnerException != null && ex.InnerException.Message.StartsWith("Code: UnknownError"))
{
//wait, retry
System.Threading.Thread.Sleep(500);
}
else
throw;
}
finally
{
tries++;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With