microsoft-graph-apimicrosoft-graph-edu

Microsoft Graph returns "Internal Server Error" on request?


I am trying to get my Microsoft Teams assignments through Microsoft Graph. I submit this GET request https://graph.microsoft.com/beta/education/me/classes/{id}/assignments as shown in the docs, with my authentication token as a header. However, below is the reply I get. I am doing this with python, however I have also tried from Graph Explorer which yields the same result.

{
"error": {
  "code": "InternalServerError",
  "message": "Object reference not set to an instance of an object.",
  "innerError": {
    "date": "2020-09-07T16:44:48",
    "request-id": "011086a0-9240-4896-9363-d403a1a0fb05"
    }
  }
}

Does anybody have any insight? Is this a problem with Microsoft?


Solution

  • You need to remove the /me. The correct URI is https://graph.microsoft.com/beta/education/classes/{id}/assignments.

    From the documentation

    POST https://graph.microsoft.com/beta/education/classes/11019/assignments
    Content-type: application/json
    Content-length: 279
    
    { 
      "dueDateTime": "2014-02-01T00:00:00Z",
      "displayName": "Midterm 1",
        "instructions":  {
          "contentType": "text",
          "content": "Read chapters 1 through 3"
        },
          "grading": {
            "@odata.type": "#microsoft.education.assignments.api.educationAssignmentPointsGradeType",
            "maxPoints": 100
          },
          "assignTo": {
            "@odata.type": "#microsoft.education.assignments.api.educationAssignmentClassRecipient"
          },
          "status":"draft",
          "allowStudentsToAddResourcesToSubmission": true
    }