microsoft-graph-api - OneDrive 中的限制

标签 microsoft-graph-api onedrive

我们有一个注册的 AAD 应用程序标记为 Multi-Tenancy 。我们正在使用此 App ID 为 Microsoft Graph 生成 token 。

  • 第一个用户是注册应用程序的租户中的全局管理员。
  • 第二个用户是另一个租户的一部分。

  • 当第二个用户尝试使用 Microsoft Graph 从 OneDrive 获取信息时,我们有时会收到 HTTP 429 activityLimitReached错误。

    我们阅读了关于 throttling 的指南它说在 Retry-After 之后重复请求响应头中的值。但在我们的例子中没有 Retry-After响应中的字段。

    我们通过每天执行一个请求收到此错误。还有,收到429后,我们可以重试并获得成功的结果(经过多次尝试)。这个错误只出现在OneDrive,其他服务都OK。

    我们能做些什么来避免429错误?我们如何检查当前限制或增加它?

    请求示例
    GET https://graph.microsoft.com/v1.0/users/:userId/drives
    

    响应示例
    HTTP/1.1 429 
    Cache-Control: private
    Transfer-Encoding: chunked
    Content-Type: application/json
    request-id: 377d2cdf-7be3-4286-819a-46060330365f
    client-request-id: 377d2cdf-7be3-4286-819a-46060330365f
    x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West Europe","Slice":"SliceA","Ring":"4","ScaleUnit":"000","Host":"AGSFE_IN_13","ADSiteName":"AMS"}}
    Duration: 170.5668
    Strict-Transport-Security: max-age=31536000
    Date: Wed, 23 May 2018 11:39:08 GMT
    
    {
      "error": {
        "code": "activityLimitReached",
        "message": "The request has been throttled",
        "innerError": {
          "request-id": "377d2cdf-7be3-4286-819a-46060330365f",
          "date": "2018-05-23T11:39:09"
        }
      }
    }
    

    最佳答案

    What can we do to avoid 429 error? How can we check the current limit or increase it?



    为了避免429错误,我们必须控制我们的请求,不要在有限的时间内做太多的请求。限制问题是我们现在无法增加的已知问题。

    Setting and publishing exact throttling limits sounds very straightforward, but in fact, it's not the best way to go. We continually monitor resource usage on SharePoint Online. Depending on usage, we fine-tune thresholds so users can consume the maximum number of resources without degrading the reliability and performance of SharePoint Online.



    以上引用来自关于限制和 OneDrive for Business/SharePoint 的 MS 文档:https://docs.microsoft.com/en-us/sharepoint/dev/general-development/how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online

    我建议去 UserVoice for Graph并提出改进建议(或赞成现有的改进)。反馈有助于产品组根据对这些建议改进的兴趣确定 future 工作的优先级。但基于上述官方文档,最好的解决方案仍然是控制我们的请求而不是功能请求 .

    关于microsoft-graph-api - OneDrive 中的限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52217530/

    相关文章:

    javascript - 列出 OneDrive 目录内容而不递归到子目录

    c# - Microsoft Graph API,文件夹资源类型

    microsoft-graph-api - 用于许可 User.Invite.All 的 MS 图 guid

    microsoft-graph-api - Microsoft Graph API - 限制

    onedrive - 在 One Drive for Business 中创建应用程序文件夹 - 权限

    java - android 从网络读取文本文件

    c# - token 已过期 - 下一步该做什么?

    c++ - Microsoft Graph - CompactToken 解析失败,错误代码为 : 8004920A

    azure - 如何从控制台应用程序 C# 调用 Microsoft Graph

    android - 使用 Microsoft Graph 在 Microsoft 日历中创建事件