我正在尝试创建一个附加了多个文件的课堂作业,这是我的代码,包含一个文件:
Classroom.Courses.CourseWork.create({
courseId: id,
title : title,
description : desc,
workType : 'ASSIGNMENT',
materials: [
{
driveFile:{
driveFile: {
id: fileId,
title: fileName
},
shareMode: "STUDENT_COPY"
},
}
],
state : "PUBLISHED"
}, id)
如何添加其他文件?我试图复制'driveFile'没有运气:
materials: [
{
driveFile:{
driveFile: {
id: fileId,
title: fileName
},
shareMode: "STUDENT_COPY"
},
driveFile:{
driveFile: {
id: fileId,
title: fileName
},
shareMode: "STUDENT_COPY"
},
}
],
无法找到任何文档或其他问题。
谢谢!
答案 0 :(得分:1)
试试这段代码:
{
"workType": "ASSIGNMENT",
"materials": [
{
"driveFile": {
"driveFile": {
"id": "FILE_ID",
"title": "TestingFile"
},
"shareMode": "STUDENT_COPY"
}
},
{
"driveFile": {
"driveFile": {
"id": "FILE_ID",
"title": "Sample Docs"
},
"shareMode": "STUDENT_COPY"
}
}
],
"description": "Assignment 1 &2",
"title": "Assignment"
}
结果如下:
我使用Method: courses.courseWork.create尝试使用此API来帮助我正确构建请求。
希望这有帮助。