首页 > 解决方案 > 不允许使用 Microsoft Graph 教育 API 方法

问题描述

当我尝试在 Graph 资源管理器“ https://graph.microsoft.com/v1.0/education/classes ”中创建课程并提出以下要求时。

{
    "description": "Class 9th Frist batch",
    "classCode": "9th-A",
    "displayName": "9th Class",
    "externalId": "11019",
    "externalName": "9th Class",
    "externalSource": "sis",
    "mailNickname": "fineartschool.net"
}

回复:

{
    "error": {
        "code": "MethodNotAllowed",
        "message": "Method not allowed.",
        "innerError": {
            "request-id": "7daf0b9c-165a-4c18-a2b9-b90a59d00cc6",
            "date": "2020-05-19T13:26:06"
        }
    }
}

我能够列出和创建日历和事件,但我不能创建或列出类。谁能指导我我的帐户有什么问题?为什么我得到以上回应。我如何使用教育 API?

标签: microsoft-graph-apimicrosoft-graph-edu

解决方案


这里的问题是 Graph Explorer 使用 Delegated 范围,但Create educationClass端点只接受 Application 范围:

  • 委派(工作或学校帐户):不支持。
  • 委派(个人 Microsoft 帐户):不支持。
  • 应用:EduRoster.ReadWrite.All

由于不支持委托范围,因此您将无法使用 Graph Explore 创建类。您将需要使用自己的代码/应用程序来请求EduRoster.ReadWrite.All范围并使用客户端凭据 OAuth 授权来获取您的令牌。


推荐阅读