question

JanSchmidt-5828 avatar image
0 Votes"
JanSchmidt-5828 asked SharadSharma-5461 answered

Uploading file to assignment stopped working

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://docs.microsoft.com/en-us/graph/api/educationsubmission-setupresourcesfolder

office-teams-app-devmicrosoft-graph-teamworkmicrosoft-graph-education
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

  • ok, when say it doesn't work or stopped working, then are you receiving any error? If yes, please share the detailed error info (requestid, timestamp).

  • Also see if you can repro the issue outside of your application using Graph Explorer or POSTMAN as well?

0 Votes 0 ·

see updated question above.

0 Votes 0 ·
NikithaMSFT-0176 avatar image
0 Votes"
NikithaMSFT-0176 answered JosephRaj-0806 commented

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://docs.microsoft.com/en-us/graph/api/driveitem-post-children?view=graph-rest-1.0&tabs=http like we are doing today in our UI.

· 16
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I found the "updated Graph Call" in the documentation here: https://docs.microsoft.com/en-us/graph/api/educationsubmission-setupresourcesfolder
Actually it is a new call to create the resource folder for a submission.

This solves my issue. If I find submission.resourcesFolderUrl == null I can now just call "/education/classes/{id}/assignments/{id}/submissions/{id}/setUpResourcesFolder" to create the folder. If I request the submission again afterwards submission.resourcesFolderUrl is set and I can upload files.

1 Vote 1 ·

Thank you for your helpful answer and for updating the Graph Call. Which Call will create the folder? So far I first uploaded the file (PUT on [submission.resourcesFolderUrl]:/[filename]:/content) and then added a related submission resource. So I need the submission folder first.

I also tried the workaround and created the submission folder. But how can I update submission.resourcesFolderUrl to point to that folder? So far Teams UI does not recognize my new folder and creates a second one.

0 Votes 0 ·

Please check this docs

0 Votes 0 ·

I guess the docs (updating a DriveItem) should answer my first question and you suggest uploading the file to another folder first and moving it after creation of the submission resource. Correct?

Could you please also comment on my second question about the temporary workaround?

0 Votes 0 ·
Show more comments

This is the same doc as in your answer and I already created a folder. My question is how to update the submission (resourcesFolderUrl) or make Teams recognise the folder in another way (so that it uses this folder for uploads of this student).

0 Votes 0 ·
Show more comments

I also have this issue, I used getResourcesFolderUrl endpoint on my template deployment to create the assignment folder and get the URL
At this moment the folder is not created and I don't have a URL to upload the resource files.
The new property resourcesFolderUrl is null when the assignment is created.

I have the same problem as @JanSchmidt-5828 , if we create a folder with the same name of assignment when someone uses the Teams UI to add a new resource it created a new folder.

When we have assignments with the same name the resourcesFolderUrl endpoint would create a different folder for each one of them and we used each URL to each folder.
At this moment is harder to manage this

On a Microsoft Blog post, they said "We are working on details of the new APIs that will allow setting up the resource folders. We will be publishing those details in an upcoming blog post. Until then, no action is needed."

I cant find where are the new APIs to do this.

0 Votes 0 ·

Why not putting a property on the create assignment endpoint to create or not the assignment folder?

When set to create, creates the folder and return the resourcesFolderUrl value instead of null.

This should be an option and not removing completly, Now is way harder to create the folder and link to the assignment

0 Votes 0 ·

This does not help when the assignments have already been submitted and I need to update the attachments


II followed the documentation to get the fileUrl retrieve the object and then update the item using onedrive api but the disappearance of fileUrl has now made it impossible to do this

This response object - https://docs.microsoft.com/en-us/graph/api/educationassignment-list-resources?view=graph-rest-beta&tabs=http has changed


0 Votes 0 ·

Sorry, trying to update a resource attachment as shown here - https://docs.microsoft.com/en-us/graph/api/educationsubmittedsubmissionresource-get?view=graph-rest-beta

The fileUrl has gone missing in the response object and hence unable to retrieve the attachment and then update the item. This was working till this roll out from MS


0 Votes 0 ·

Post my query here yesterday, the documentation has been updated to remove fileUrl from response object! So, now there is no way to get to the attachment of a submission

0 Votes 0 ·
Show more comments
TonyBear-0233 avatar image
0 Votes"
TonyBear-0233 answered JanSchmidt-5828 commented

I am having the same problem as @PedroMonte-2137 and @JanSchmidt-5828, 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.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

For me the new graph call announced in the accepted answer solved the problem. Here my explanation from the comment of the accepted answer:

I found the "updated Graph Call" in the documentation here: https://docs.microsoft.com/en-us/graph/api/educationsubmission-setupresourcesfolder
Actually it is a new call to create the resource folder for a submission.

This solves my issue. If I find submission.resourcesFolderUrl == null I can now just call "/education/classes/{id}/assignments/{id}/submissions/{id}/setUpResourcesFolder" to create the folder. If I request the submission again afterwards submission.resourcesFolderUrl is set and I can upload files.

0 Votes 0 ·
JosephRaj-0806 avatar image
0 Votes"
JosephRaj-0806 answered JosephRaj-0806 commented

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://docs.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

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

To rephrase I just ned to get to the Item id of the drive so I can access it

0 Votes 0 ·
MeiTan-8494 avatar image
2 Votes"
MeiTan-8494 answered MeiTan-8494 published

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SharadSharma-5461 avatar image
0 Votes"
SharadSharma-5461 answered

Hi Fellow Developers,

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

Happy coding!


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.