6
votes

Does anyone know what to do when you get "UnknownError" from Graph API? Or the right site to ask Microsoft?

Thanks

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"
    }
  }
}
4
This is a long-shot, but is there anything further in the InnerError? docs.microsoft.com/en-us/graph/…Paul Schaeflein
no, anything else in the InnerErrorErick B
I'm sometimes having the same error when getting a calendar with a delta token. It seems to occur when Outlook is updating the mailbox local cache. I had to implement delayed retry logic to workaround it.bN_

4 Answers

2
votes

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

1
votes

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.

1
votes

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++;
                }
            }
-1
votes

having the same issue - posted on their github: https://github.com/microsoftgraph/microsoft-graph-docs/issues/5853#issuecomment-660245066

➜  curl -vv -H "Authorization: $H" https://graph.microsoft.com/beta/me/messages\?%24filter\=isDraft+eq+false+and+lastModifiedDateTime+lt+2020-02-03T15%3A54%3A49Z\&%24orderby\=lastModifiedDateTime+desc\&%24skip\=34\&%24top\=1
*   Trying 20.190.132.119...
* TCP_NODELAY set
* Connected to graph.microsoft.com (20.190.132.119) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=graph.microsoft.com
*  start date: Jul  1 21:55:17 2020 GMT
*  expire date: Jul  1 21:55:17 2022 GMT
*  subjectAltName: host "graph.microsoft.com" matched cert's "graph.microsoft.com"
*  issuer: C=US; ST=Washington; L=Redmond; O=Microsoft Corporation; OU=Microsoft IT; CN=Microsoft IT TLS CA 2
*  SSL certificate verify ok.
> GET /beta/me/messages?%24filter=isDraft+eq+false+and+lastModifiedDateTime+lt+2020-02-03T15%3A54%3A49Z&%24orderby=lastModifiedDateTime+desc&%24skip=34&%24top=1 HTTP/1.1
> Host: graph.microsoft.com
> User-Agent: curl/7.64.1
> Accept: */*
> Authorization: Bearer <TOKEN>
>
< HTTP/1.1 503 Service Unavailable
< Cache-Control: private
< Content-Type: application/json
< request-id: fe488121-fda3-439e-a059-435630a710a7
< client-request-id: fe488121-fda3-439e-a059-435630a710a7
< x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West US","Slice":"SliceC","Ring":"5","ScaleUnit":"003","RoleInstance":"AGSFE_IN_37"}}
< Strict-Transport-Security: max-age=31536000
< Date: Fri, 17 Jul 2020 17:30:42 GMT
< Content-Length: 198
<
{
  "error": {
    "code": "UnknownError",
    "message": "",
    "innerError": {
      "date": "2020-07-17T17:30:42",
      "request-id": "fe488121-fda3-439e-a059-435630a710a7"
    }
  }
* Connection #0 to host graph.microsoft.com left intact
}* Closing connection 0