Microsoft graph api 微软图形应用编程接口-“;代码";:&引用;“未知错误”;

Microsoft graph api 微软图形应用编程接口-“;代码";:&引用;“未知错误”;,microsoft-graph-api,microsoft-graph-mail,Microsoft Graph Api,Microsoft Graph Mail,有人知道当您从Graph API中得到“UnknownError”时该怎么办吗? 或者是问微软的正确网站 谢谢 请求: 答复: { "error": { "code": "UnknownError", "message": "", "innerError": { "request-id": "1ea27a29-5491-44d2-824a-0aaee9280c40", "date": "2019-09-13T19:48:30" }

有人知道当您从Graph API中得到“UnknownError”时该怎么办吗? 或者是问微软的正确网站

谢谢

请求:

答复:

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

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

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


如果这不起作用,那么提出这个问题的相关位置似乎在Graph API GitHub上,它在这里

HTTP错误代码将为您提供更多关于出错原因的详细信息。如果是403或401,则是身份验证错误。如果是500或503,则是服务器错误

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

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++;
                }
            }
IDriveItemChildrenCollectionPage folderitems=null;
bool done=false;
Int16=0;
而(!完成并尝试<3次)
{
尝试
{
DriveItem folderitem=null;
if(folder.Equals(“”)
folderitem=SPclient.Sites[siteId]。列出[listId]。驱动器。根目录。请求()。GetAsync()。结果;
其他的
folderitem=SPclient.Sites[siteId]。列出[listId]。驱动器。根目录。ItemWithPath(文件夹)。请求()。GetAsync()。结果;
folderitems=SPclient.Sites[siteId]。列出[listId]。驱动器。项[folderitem.Id]。子项。请求().GetAsync().Result;
完成=正确;
}
捕获(例外情况除外)
{
if(ex.InnerException!=null&&ex.InnerException.Message.StartsWith(“代码:未知错误”))
{
//等待,重试
系统.线程.线程.睡眠(500);
}
其他的
投掷;
}
最后
{
尝试++;
}
}

有相同的问题-发布在他们的github上:

➜  curl-vv-H“授权:$H”https://graph.microsoft.com/beta/me/messages\?%24filter\=isDraft+eq+false+和+lastModifiedDateTime+lt+2020-02-03T15%3A54%3A49Z\&24orderby\=lastModifiedDateTime+desc\&24skip\=34\&24top\=1
*正在尝试20.190.132.119。。。
*TCP_节点集
*已连接到graph.microsoft.com(20.190.132.119)端口443(#0)
*阿尔卑斯山,提供h2
*ALPN,提供http/1.1
*已成功设置证书验证位置:
*CAfile:/etc/ssl/cert.pem
卡帕斯:没有
*TLSv1.2(输出),TLS握手,客户端问候(1):
*TLSv1.2(IN)、TLS握手、服务器hello(2):
*TLSv1.2(IN),TLS握手,证书(11):
*TLSv1.2(IN)、TLS握手、服务器密钥交换(12):
*TLSv1.2(IN),TLS握手,服务器完成(14):
*TLSv1.2(输出)、TLS握手、客户端密钥交换(16):
*TLSv1.2(OUT),TLS更改密码,更改密码规范(1):
*TLSv1.2(输出),TLS握手,完成(20):
*TLSv1.2(IN),TLS更改密码,更改密码规范(1):
*TLSv1.2(IN),TLS握手,完成(20):
*使用TLSv1.2/ECDHE-RSA-AES128-GCM-SHA256的SSL连接
*ALPN,服务器不同意协议
*服务器证书:
*主题:CN=graph.microsoft.com
*开始日期:7月1日21:55:17格林尼治标准时间2020
*到期日期:格林威治标准时间7月1日21:55:17 2022
*subjectAltName:主机“graph.microsoft.com”匹配证书的“graph.microsoft.com”
*发行人:C=美国;ST=华盛顿;L=雷蒙德;O=微软公司;OU=微软IT;CN=微软IT TLS CA 2
*SSL证书验证正常。
>获取/beta/me/messages?%24filter=isDraft+eq+false+和+lastModifiedDateTime+lt+2020-02-03T15%3A54%3A49Z&%24orderby=lastModifiedDateTime+desc&%24skip=34&%24top=1 HTTP/1.1
>主持人:graph.microsoft.com
>用户代理:curl/7.64.1
>接受:*/*
>授权:持票人
>
这是一个很难解决的问题,但是内部错误中是否还有其他问题?不,InnerError中的任何其他内容我有时在获取带有delta标记的日历时也会遇到相同的错误。Outlook在更新邮箱本地缓存时似乎会发生这种情况。我必须实施延迟重试逻辑来解决此问题。这是一个504网关超时。此邮箱上是否继续发生此504错误?我注意到您正在执行$skip=25651&$top=1,您设置的查询窗口中是否有那么多消息?在检查与此相同问题相关的链接github问题后,他们都说要在stackoverflow上在此发布;)
➜  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