I am using the following lines of Apps Script to dynamically generate a Google Forms Quiz
form.setIsQuiz(true);
form.setTitle("New")
.setDescription('Test')
.setConfirmationMessage('Thanks for responding!')
.setAllowResponseEdits(false)
.setAcceptingResponses(true)
.setLimitOneResponsePerUser(true)
.setShuffleQuestions(true)
.setProgressBar(true)
.setCollectEmail(true)
This is creating a form and i am able to send out the quizzes to multiple people. But i also want to "Release Score >> Immediately After Submission". This is a feature in Google Quiz Form. But i am unable to find a method equivalent to the Google Forms feature of "Release Score >> Immediately After Submission".
I cannot do this manually for each form because i generate hundreds of forms distributed to different sets of people.
AFAIAA, there is no means to do this directly using a Google Apps Script method at this time.
A possible workaround is to create a minimal Google Form, make it a quiz, and configure it to 'Immediately after each submission'. Instead of creating the form within the script, merely duplicate this Form file (using your script) and proceed to build your quiz programmatically in the copy.
It is worth noting that this omission in Google Apps Script can result in a bug in the completed quiz. When a Form is created using a script and .setIsQuiz(true) method is used to to turn it into a quiz, the "Release marks" setting defaults to "Later, after manual review". In the Forms settings User Interface, this option includes the note "Turns on email collection" - This is so that when results are released manually, there is an email address to send the results to. When a Quiz is created using the steps above, email collection is not enabled. This means it is not possible to release the results manually. The workaround described above alleviates this issue.
来源:https://stackoverflow.com/questions/44471090/release-grade-immediately-after-submission-how-to-do-using-apps-script