【问题标题】:Create Term (group) in Term store using Microsoft Graph API使用 Microsoft Graph API 在术语库中创建术语(组)
【发布时间】:2022-07-14 01:57:16
【问题描述】:

我想使用 Microsoft Graph API 在 SharePoint 术语组中创建一个新术语组

使用 Azure Active Directory 中的以下权限通过 get 请求读取术语组:“TermStore.ReadWrite.All - 应用程序 - 读取和写入所有术语库数据。

但是通过 post 请求创建会导致错误 400/403。

Termstore 应用程序权限在 AAD 中可用,但文档并未说明。 Link to MS graph termstore doc.

termstore_get_groups = (
req.get(
    url = f"https://graph.microsoft.com/v1.0/sites/{root_site_id}/termStore/groups",
    headers= {"Authorization" : f"Bearer {access_token}", "Host" : "graph.microsoft.com"}
    )
    )

termstore_create_group = (
req.post(
    url = f"https://graph.microsoft.com/v1.0/sites/{root_site_id}/termStore/groups",
    headers= {"Authorization" : f"Bearer {access_token}"},
    data= {"displayName" : "Test"}
    )
    )

【问题讨论】:

    标签: python-3.x azure-active-directory microsoft-graph-api


    【解决方案1】:

    请尝试添加 Content-Type: application/json 这是必需的标头以及授权标头。

     headers= {"Authorization" : f"Bearer {access_token}" ,.....,'Content-Type': 'application/json'}
    

    因为这是必需的 Create termStore group - Microsoft Graph v1.0 | Microsoft Docs

    如果用户对您尝试更新术语的组没有足够的权限/特权,甚至可能发生这种情况。请检查用户是否需要至少有一个“贡献者”到该术语的父组。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-29
      • 2010-10-13
      • 1970-01-01
      • 2013-01-31
      • 2022-10-07
      相关资源
      最近更新 更多