You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Microsoft Graph API获取Teams会议录制文件遇权限禁止错误

问题:调用Microsoft Graph API获取Teams会议录制文件时返回Forbidden错误

场景说明

我正在开发一款代表用户操作的应用,需通过Microsoft Graph API获取Teams在线会议的录制文件,调用的API端点为:
https://graph.microsoft.com/v1.0/users/{user_id}/onlineMeetings/{meeting_id}/recordings

已完成的配置

  • 已添加所需的应用权限(权限配置截图已确认无误)
  • 已创建应用访问策略并授予目标用户(策略配置截图已确认无误)

代码实现

获取访问令牌的代码

data = {
    "client_id": client_id,
    "client_secret": client_secret,
    "scope": scope,
    "grant_type": grant_type
}

# 发送POST请求获取令牌
response = requests.post(url, data=data)

# 检查请求状态
if response.status_code == 200:
    print("Token retrieved successfully:")
    # print(response.json())
else:
    print("Error occurred during token retrieval:")
    print(response.text)
bearer_token = response.json()["access_token"]

调用录制文件API的代码

url = f"https://graph.microsoft.com/v1.0/users/user_id/onlineMeetings/{meeting_id}/recordings"

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

# 发送GET请求获取录制文件
response = requests.get(url, headers=headers)

# 检查请求状态
if response.status_code == 200:
    print("User data retrieved successfully:")
    print(response.content)
else:
    print("Error occurred during user data retrieval:")
    print(response.text)
    print("Status Code:", response.status_code)

遇到的错误

调用API时返回如下Forbidden错误:

{"error":{"code":"Forbidden","message":"Application is not allowed to perform operations on the user {user_id}, neither is allowed access through RSC permission evaluation.","innerError":{"date":"2024-08-27T05:37:36","request-id":"request_id","client-request-id":"client_id"}}}

已尝试的解决措施

按照官方文档及过往解决方案提示,已创建应用访问策略并授予目标用户,但仍收到相同的Forbidden错误。


内容的提问来源于stack exchange,提问作者Yash Mishra

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 17:55:13