【发布时间】: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