【问题标题】:Microsoft Graph API - GET Grading 'maxPoints' for AssignmentMicrosoft Graph API - 为作业获取评分“maxPoints”
【发布时间】:2018-11-12 11:58:02
【问题描述】:

我正在使用带有 Laravel 的 Microsoft Graph API 并尝试使用其评分点提取课程作业 - maxPoints 属性。这个端点是/education/classes/{classID}/assignments

我可以成功调用数据并转储它返回以下数据。

[
  "id" => "*****-****-****-****-*********"
  "classId" => "*****-****-****-****-*********"
  "displayName" => "Encryption and Decryption"
  "dueDateTime" => "2018-10-29T12:30:00Z"
  "status" => "assigned"
  "grading" => [
    "@odata.type" => "#microsoft.graph.educationAssignmentPointsGradeType"
    "maxPoints" => 100
  ]
]

评分返回时其 odata 类型设置为 EducationAssignmentPointsGradeType 类类型,并且 maxPoints 属性可用。这就是我卡住的地方。然后,我使用以下方法遍历视图中的数据:

@foreach($assignments as $assignment)
  {{ $assignment->getGrading()->getMaxPoints() }} 
@endforeach

但是这会返回以下错误:

Call to undefined method Microsoft\Graph\Beta\Model\EducationAssignmentGradeType::getMaxPoints()

getGrading() 方法的类型为 EducationAssignmentGradeType。但是,我不确定如何从中获取 maxPoints,因为 EducationAssignmentGradeType 类中包含 no methods。但是,EducationAssignmentPointsGradeType 类具有可用的 getMaxPoints 方法。

我将如何调用getMaxPoints 方法?

【问题讨论】:

    标签: php microsoft-graph-api microsoft-graph-sdks microsoft-graph-edu


    【解决方案1】:

    我相信您的问题是Microsoft Graph SDK 仅支持/v1.0,而Assignments 目前仅在/beta 端点中可用。

    您似乎是using the Beta models,但我在这些方面的经验充其量只是成败。查看EducationAssignmentGradeType model,自从maxPoints 推出测试版以来,模型似乎没有更新(EducationAssignmentPointsGrade 模型中也缺少points

    【讨论】:

    • 我希望我们很快就会有一个适用于 .Net 的 beta SDK ......祈祷吧!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-04-06
    • 1970-01-01
    • 2023-01-01
    • 2020-07-21
    • 1970-01-01
    • 1970-01-01
    • 2023-03-13
    相关资源
    最近更新 更多