7

当您从 Graph API 获得“UnknownError”时,有谁知道该怎么做?

请求: 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

回复:

{
  "error": {
    "code": "UnknownError",
    "message": "",
    "innerError": {
      "request-id": "1ea27a29-5491-44d2-824a-0aaee9280c40",
      "date": "2019-09-13T19:48:30"
    }
  }
}
4

4 回答 4

2

我在 Graph API 的另一部分遇到了同样的错误。我相信这是一个权限错误,最简单的测试方法很可能是使用 Graph Explorer。

https://developer.microsoft.com/en-us/graph/graph-explorer

在那里运行请求并为自己分配相关权限。

如果这不起作用,那么提出这个问题的相关地方似乎是在 Graph API GitHub 上,这里是https://github.com/microsoftgraph/microsoft-graph-docs

于 2019-09-24T10:18:52.023 回答
1

在检索文件和文件夹结构的应用程序上,我现在更频繁地收到错误。我的解决方法是检测错误,稍等片刻,然后重试。

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++;
                }
            }
于 2019-11-05T09:35:37.037 回答
1

HTTP 错误代码将为您提供有关问题所在的更多详细信息。如果是 403 或 401,那么这是一个身份验证错误。如果是 500 或 503,那么这是服务器错误。

于 2019-09-30T15:25:39.273 回答
-1

有同样的问题 - 发布在他们的 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
于 2020-07-17T17:53:11.697 回答