Uploading file to assignment stopped working

Jan Schmidt 31 Reputation points
2021-03-23T11:14:40.153+00:00

Hello everybody,

I use graph education API to "add work" (files) to an assignment in Teams for Education.

This does not work anymore for assignments created since last week because creating an assignment in Teams no longer creates the directories for the students to upload their work. These are now only created when a student uploads a file in the Teams App.

Using graph API and asking for the educationSubmissions of the assignment, the resourcesFolderUrl is null. So I cannot upload a file and I cannot find a way to create the folders using graph API.

I am happy about any help!

Steps to reproduce:

  1. Create an Assignment in Teams for Education and assign it to a Team
  2. Get ID of team and assignment via https://graph.microsoft.com/beta/education/me/classes and https://graph.microsoft.com/beta/education/classes/[id]/assignments.
  3. Get submissions of assignment via https://graph.microsoft.com/beta/education/classes/[id]/assignments/[id]/submissions. Each resourcesFolderUrl is null until the corresponding user uploads a file in Teams App.

I am not receiving any error, but educationSubmission.resourcesFolderUrl always is null for new assignments. And so I cannot upload any files there.

Yes, I can repro this using Graph Explorer.
Just create and assign an assignment and then check https://graph.microsoft.com/beta/education/classes/[id]/assignments/[id]/submissions using Graph Explorer. You will find each submission with "resourcesFolderUrl": null.
For assignments created at least two weeks ago, educationSubmission.resourcesFolderUrl still has a correct value like "resourcesFolderUrl": "https://graph.microsoft.com/v1.0/drives/b!3egbNkfJ_ky"

For new assignments these folders are not created at all, even if the assignment is created using the Teams App. So there are two options:

  • This is an error in the creation of assignments
  • This is intended behavior and there is an undocumented extra command to create the resource folders (Teams App creates the folder on upload but I don't know how to do this from my app).

For an explanation of the accepted answer see my last comment. The key is this new Graph Call: https://learn.microsoft.com/en-us/graph/api/educationsubmission-setupresourcesfolder

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,289 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,346 questions
{count} votes

Accepted answer
  1. Nikitha-MSFT 541 Reputation points
    2021-05-04T04:16:04.18+00:00

    Unrelated to Graph update, we started not creating Submission Folders for students, until the students actually started to submit content. We just wanted to be mindful of not creating a lot of empty folders in SharePoint. So in the UI when a student is trying to upload a file , we create the folder through Graph and upload the file to it.

    Workaround

    We will update the Graph Call, to also create submission folder (just like the UI does), this update should be rolling out in the next two weeks, but in the meantime, you can crate submission folders https://learn.microsoft.com/en-us/graph/api/driveitem-post-children?view=graph-rest-1.0&tabs=http like we are doing today in our UI.


4 additional answers

Sort by: Most helpful
  1. Mei Tan 11 Reputation points
    2021-05-27T15:47:25.04+00:00

    Hi! You can use this new API to set up a resources folder for the assignment: https://learn.microsoft.com/en-us/graph/api/educationassignment-setupresourcesfolder?view=graph-rest-beta

    2 people found this answer helpful.
    0 comments No comments

  2. Tony Bear 81 Reputation points
    2021-05-21T00:01:49.07+00:00

    I am having the same problem as @Pedro Monte and @Jan Schmidt , when an assignment is created by an API call it does not setup the Resources folder and link it to the Assignment. I can create a folder in the right location using separate api calls but cannot write the value "resourcesFolderUrl" back to the assignment as it is read only.

    Any help would be appreciated as this will open many doors in our organisation.


  3. Joseph Raj 1 Reputation point
    2021-05-21T15:24:27.647+00:00

    I have a different issue but related. I was using the fileUrl to update an resource attachment item using the documentation in the link -

    https://learn.microsoft.com/en-us/graph/api/educationsubmittedsubmissionresource-get?view=graph-rest-beta

    Now the fileUrl attribute at submitted resource level has suddenly disappeared for newer assignments! Can someone help on how to update an existing attach item or rather get the url to the attachment item since this has gone missing


  4. Sharad Sharma 1 Reputation point Microsoft Employee
    2021-07-23T21:54:34.327+00:00

    Hi Fellow Developers,

    If you are facing any of the issues with resource upload, I recommend referring to this documentation page - https://learn.microsoft.com/en-us/graph/education-upload-resource-overview. It has all the necessary steps outlined with an example.

    Happy coding!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.