创建作业时无法设置studentWorkFolder

时间:2018-09-26 18:20:57

标签: google-api-php-client google-classroom

我正在使用php库为学生创建作业。我与这些学生共享特定文件夹中的特定文件。作业中的每个学生都可以编辑作业或向作业中添加新文件。

一切正常,但是当他们提交新文件时,它不会将它们添加到任务专用的当前文件夹中,但会在教室根目录中创建一个新文件夹。我正在尝试设置studentWorkFolder,使其指向适当的google驱动器文件夹,但是在创建分配时不会保存该文件。

这是代码:

$courseWork = new \Google_Service_Classroom_CourseWork(array(
    "courseId"      => $classroomId,
    "title"         => $titleOfAssignment,
    "workType"      => "ASSIGNMENT",
    "description"   => $descriptionOfAssignment,
    "state"         => "PUBLISHED",
    "assigneeMode"  => "INDIVIDUAL_STUDENTS",
    "individualStudentsOptions" => [
        "studentIds" => $classroomStudents
    ],
    "materials"     => $materials,       
    "assignment" => [
        "studentWorkFolder" => [
            "id" => $myFolderId,
            "title" => $titleOfAssignment,
            "alternateLink" => "https://drive.google.com/drive/u/0/folders/${myFolderId}"
        ]
    ]     
));


var_dump($courseWork->getAssignment());
$courseWork   = $this->teacherClassroomService->courses_courseWork->create($classroomId, $courseWork);    
var_dump($courseWork->getAssignment());

第一个var_dump随每个字段集一起返回我的Google_Service_Classroom_Assignment。创建分配后,第二个var_dump返回null。 Google课堂中的所有内容(被分配人,材料)都运行良好,只是当我单击“打开作业文件夹”时,它会转到一个随机文件404,当学生添加文档或提交作业时,它将创建一个新文件夹根。

没有办法设置studentWorkFolder吗?我在API上看到它是只读的,但是我在创建课程作业时进行了设置。

谢谢!

亚瑟

编辑:我尝试直接使用REST API,并且相同,它忽略了带有StudentWorkFolder的“赋值”键

{
    "courseId": "my course id",
    "title": "Test",
    "description": "Test",
    "materials": [],
    "state": "PUBLISHED",
    "workType": "ASSIGNMENT",
    "submissionModificationMode": "MODIFIABLE_UNTIL_TURNED_IN",
    "associatedWithDeveloper": true,
    "assigneeMode": "INDIVIDUAL_STUDENTS",
    "individualStudentsOptions": {
        "studentIds": [
            "a student id"
        ]
    },
    "assignment": {
        "studentWorkFolder":{
            "id": "a folder id"
        }
    }
}

返回此

{
    "courseId": "my course id",
    "id": "18228858914",
    "title": "Test",
    "description": "Test",
    "state": "PUBLISHED",
    "alternateLink": "http://classroom.google.com/c/MTc2NjE4ODE2ODJa/a/MTgyMjg4NTg5MTRa/details",
    "creationTime": "2018-09-26T18:31:03.679Z",
    "updateTime": "2018-09-26T18:31:03.640Z",
    "workType": "ASSIGNMENT",
    "submissionModificationMode": "MODIFIABLE_UNTIL_TURNED_IN",
    "associatedWithDeveloper": true,
    "assigneeMode": "INDIVIDUAL_STUDENTS",
    "individualStudentsOptions": {
        "studentIds": [
            "a student"
        ]
    },
    "creatorUserId": "105680516965248663531"
}

0 个答案:

没有答案