0
下面的代码适用于大多数的学生在教室里时,他们提交asignment调用返回400错误,但它抛出一个400错误的异常对一些学生:ModifyAttachments使用C#客户端库
var classroom = GetClassroomService();
var studentSubmissionsResponse = classroom.Courses.CourseWork.StudentSubmissions.List(courseId, courseWorkId).Execute();
var submission = studentSubmissionsResponse.StudentSubmissions.FirstOrDefault(s => s.AssociatedWithDeveloper ?? false);
var modifyAttachmentRequest = new global::Google.Apis.Classroom.v1.Data.ModifyAttachmentsRequest();
var link = new global::Google.Apis.Classroom.v1.Data.Link() { Url = url };
var attachment = new global::Google.Apis.Classroom.v1.Data.Attachment() { Link = link };
modifyAttachmentRequest.AddAttachments = new System.Collections.Generic.List<global::Google.Apis.Classroom.v1.Data.Attachment>();
modifyAttachmentRequest.AddAttachments.Add(attachment);
submission = classroom.Courses.CourseWork.StudentSubmissions.ModifyAttachments(modifyAttachmentRequest, courseId, courseWorkId, submission.Id).Execute();
/// submission code is after this; the exception is thrown by the call above
唯一的例外是:
The service classroom has thrown an exception: Google.GoogleApiException: Google.Apis.Requests.RequestError
Request contains an invalid argument. [400]
Errors [
Message[Request contains an invalid argument.] Location[ - ] Reason[badRequest] Domain[global]
]
不幸的是,C#客户端库目前不支持详细的错误信息的显示呢。
关于可能发生什么的任何想法?如何解决问题?
我希望我能做到这一点。当学生在(物理)课堂上完成作业时,会抛出异常。该错误消息表明存在无效参数。在那个调用中,改变的唯一参数是URL。我尝试过使用我自己的帐户失败的网址,他们的工作。所以,这不是网址。其他学生的课程和课程工作。只留下提交.Id,但我认为我正确得到提交。 –