代码之家  ›  专栏  ›  技术社区  ›  John Park

图形API:如何使用图形API获取敏感度标签列表

  •  0
  • John Park  · 技术社区  · 10 月前

    我正在尝试使用图形API获取敏感度标签列表。 我正在使用Graph Explorer来首先获取正确的REST url。

    https://learn.microsoft.com/en-us/graph/api/security-informationprotection-list-sensitivitylabels?view=graph-rest-beta&tabs=http

    我查看了这个guid并尝试了几个url,但失败了。

    我用这些网址失败了。

    https://graph.microsoft.com/v1.0/security/informationProtection/sensitivityLabels
    https://graph.microsoft.com/beta/users/me/security/informationProtection/sensitivityLabels
    

    这些是错误响应

    "error": {
        "code": "BadRequest",
        "message": "Resource not found for the segment 'informationProtection'.",
        "innerError": {
            "date": "2024-07-19T08:15:31",
            "request-id": "cb4a1134-b2af-4e74-9337-e65e142777c9",
            "client-request-id": "c7385ff6-bf4c-e989-3754-1b1a4e9bcba9"
        }
    }
    "error": {
        "code": "UnknownError",
        "message": "",
        "innerError": {
            "date": "2024-07-19T08:16:27",
            "request-id": "54ad97bd-8b45-44eb-a129-6a9a09e6eff7",
            "client-request-id": "7c3347bd-9dc6-ceca-9fd5-e12757890a3a"
        }
    }
    

    请提出建议。

    1 回复  |  直到 10 月前
        1
  •  1
  •   Sridevi    10 月前

    起初,我也得到了 错误 当我在我的环境中运行这些URL时,就像这样:

    GET https://graph.microsoft.com/v1.0/security/informationProtection/sensitivityLabels
    

    enter image description here

    GET https://graph.microsoft.com/beta/users/me/security/informationProtection/sensitivityLabels
    

    enter image description here

    得到 敏感性标签 l列表使用图形API,正确的URL应该是

    GET https://graph.microsoft.com/beta/me/security/informationProtection/sensitivityLabels
    

    答复:

    enter image description here

    GET https://graph.microsoft.com/beta/users/userID/security/informationProtection/sensitivityLabels
    

    答复:

    enter image description here