Class Form

النموذج

يشير ذلك المصطلح إلى نموذج يحتوي على سمات وعناصر عامة. تتضمن الخصائص العنوان والإعدادات وأين يتم تخزين الردود. تتضمن العناصر عناصر أسئلة مثل مربعات الاختيار أو عناصر الاختيار، بينما تشير عناصر التنسيق إلى أشياء مثل فواصل الصفحات. يمكن الوصول إلى النماذج أو إنشاؤها من FormApp.

// Open a form by ID and create a new spreadsheet.
var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
var ss = SpreadsheetApp.create('Spreadsheet Name');

// Update form properties via chaining.
form.setTitle('Form Name')
    .setDescription('Description of form')
    .setConfirmationMessage('Thanks for responding!')
    .setAllowResponseEdits(true)
    .setAcceptingResponses(false);

// Update the form's response destination.
form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());

الطُرق

الطريقةنوع القيمة التي يتم إرجاعهاوصف قصير
addCheckboxGridItem()CheckboxGridItemلإلحاق عنصر سؤال جديد، يتم تقديمه كشبكة من الأعمدة والصفوف، مما يسمح للمجيب بتحديد خيارات متعددة لكل صف من سلسلة من مربعات الاختيار.
addCheckboxItem()CheckboxItemلإرفاق عنصر سؤال جديد يسمح للمجيب بتحديد مربع اختيار واحد أو أكثر، بالإضافة إلى حقل "other" اختياري.
addDateItem()DateItemلإلحاق عنصر جديد بسؤال يسمح للمجيب بالإشارة إلى تاريخ.
addDateTimeItem()DateTimeItemلإلحاق عنصر جديد بسؤال يسمح للمجيب بالإشارة إلى التاريخ والوقت.
addDurationItem()DurationItemلإلحاق عنصر جديد بسؤال يسمح للمجيب بالإشارة إلى المدة الزمنية.
addEditor(emailAddress)Formلإضافة المستخدم المحدّد إلى قائمة المحرِّرين في Form.
addEditor(user)Formلإضافة المستخدم المحدّد إلى قائمة المحرِّرين في Form.
addEditors(emailAddresses)Formلإضافة مجموعة المستخدمين المحدّدة إلى قائمة المحرِّرين في Form.
addGridItem()GridItemلإلحاق عنصر سؤال جديد، يتم عرضه كشبكة من الأعمدة والصفوف، مما يسمح للمجيب بتحديد خيار واحد لكل صف من سلسلة من أزرار الاختيار.
addImageItem()ImageItemلإلحاق عنصر تنسيق جديد يعرض صورة.
addListItem()ListItemلإلحاق عنصر سؤال جديد يسمح للمجيب بتحديد خيار واحد من القائمة المنسدلة.
addMultipleChoiceItem()MultipleChoiceItemإضافة عنصر سؤال جديد يسمح للمجيب بتحديد خيار واحد من قائمة أزرار الاختيار أو حقل "other" اختياري.
addPageBreakItem()PageBreakItemلإضافة عنصر تنسيق جديد يمثّل بداية صفحة.
addParagraphTextItem()ParagraphTextItemلإضافة عنصر سؤال جديد يسمح للمجيب بإدخال جزء من النص.
addScaleItem()ScaleItemلإلحاق عنصر جديد بسؤال يسمح للمجيب بتحديد خيار واحد من تسلسل مرقّم لأزرار الاختيار.
addSectionHeaderItem()SectionHeaderItemلإلحاق عنصر تنسيق جديد يشير بصريًا إلى بداية القسم.
addTextItem()TextItemلإلحاق عنصر جديد بسؤال يسمح للمجيب بإدخال سطر واحد من النص.
addTimeItem()TimeItemلإلحاق عنصر جديد بسؤال يسمح للمجيب بالإشارة إلى وقت من اليوم.
addVideoItem()VideoItemلإلحاق عنصر تنسيق جديد يعرض فيديو.
canEditResponse()Booleanيحدد ما إذا كان النموذج يعرض رابطًا لتعديل الرد بعد إرساله.
collectsEmail()Booleanيحدد ما إذا كان النموذج يجمع عناوين البريد الإلكتروني للمستجيبين.
createResponse()FormResponseينشئ ردًا جديدًا على النموذج.
deleteAllResponses()Formلحذف جميع الردود المرسلة من مخزن ردود النموذج.
deleteItem(index)voidحذف العنصر في فهرس محدد بين جميع العناصر في النموذج.
deleteItem(item)voidيؤدي هذا الإجراء إلى حذف العنصر المحدّد.
deleteResponse(responseId)Formحذف رد واحد من مخزن الردود في النموذج
getConfirmationMessage()Stringيتلقّى رسالة تأكيد النموذج.
getCustomClosedFormMessage()Stringيتلقى هذا الإعداد الرسالة المخصّصة التي يتم عرضها إذا كان النموذج لا يقبل الردود، أو سلسلة فارغة في حال عدم ضبط أي رسالة مخصّصة.
getDescription()Stringالحصول على وصف النموذج
getDestinationId()Stringالحصول على رقم تعريف وجهة الرد على النموذج
getDestinationType()DestinationTypeمعرفة نوع وجهة الرد على النموذج
getEditUrl()Stringالحصول على عنوان URL الذي يمكن استخدامه للوصول إلى وضع التعديل في النموذج
getEditors()User[]يمكنك الحصول على قائمة بالمحرِّرين في Form.
getId()Stringالحصول على رقم تعريف النموذج.
getItemById(id)Itemالحصول على العنصر بمعرّف محدَّد.
getItems()Item[]الحصول على مصفوفة من جميع العناصر في النموذج
getItems(itemType)Item[]تحصل على مصفوفة من جميع العناصر من نوع معيّن.
getPublishedUrl()Stringالحصول على عنوان URL الذي يمكن استخدامه للردّ على النموذج
getResponse(responseId)FormResponseيتلقى ردًا من نموذج واحد استنادًا إلى رقم تعريف الرد الخاص به.
getResponses()FormResponse[]الحصول على مصفوفة من جميع الردود في النموذج
getResponses(timestamp)FormResponse[]الحصول على مصفوفة من جميع ردود النموذج بعد تاريخ ووقت معيّنَين
getShuffleQuestions()Booleanتحدد ما إذا كان ترتيب الأسئلة في كل صفحة من النموذج عشوائيًا.
getSummaryUrl()Stringالحصول على عنوان URL الذي يمكن استخدامه لعرض ملخّص الردود على النموذج
getTitle()Stringللحصول على عنوان النموذج.
hasLimitOneResponsePerUser()Booleanيحدد ما إذا كان النموذج يسمح بإجابة واحدة فقط لكل مجيب.
hasProgressBar()Booleanتحدِّد هذه السياسة ما إذا كان النموذج يعرض شريط تقدّم.
hasRespondAgainLink()Booleanتحدد ما إذا كان النموذج يعرض رابطًا لإرسال رد آخر بعد إكمال المستجيب للنموذج.
isAcceptingResponses()Booleanتحدِّد هذه السياسة ما إذا كان النموذج يقبل الردود حاليًا.
isPublishingSummary()Booleanتحدد ما إذا كان النموذج يعرض رابطًا لعرض ملخص الردود بعد إكمال المستجيب للنموذج.
isQuiz()Booleanتحدد ما إذا كان النموذج اختبارًا.
moveItem(from, to)Itemلنقل عنصر في فهرس معين بين جميع العناصر في النموذج إلى فهرس محدد آخر.
moveItem(item, toIndex)Itemلنقل عنصر معين إلى فهرس محدد بين جميع العناصر في النموذج.
removeDestination()Formإلغاء ربط النموذج بوجهة الرد الحالية.
removeEditor(emailAddress)Formلإزالة المستخدم المحدّد من قائمة المحرِّرين في Form.
removeEditor(user)Formلإزالة المستخدم المحدّد من قائمة المحرِّرين في Form.
requiresLogin()Booleanيحدد ما إذا كان النموذج يتطلب من المستجيبين تسجيل الدخول إلى حساب في النطاق نفسه أو في نطاق فرعي قبل الاستجابة.
setAcceptingResponses(enabled)Formلتحديد ما إذا كان النموذج يقبل الردود حاليًا أم لا.
setAllowResponseEdits(enabled)Formيحدد ما إذا كان النموذج سيعرض رابطًا لتعديل الرد بعد إرساله.
setCollectEmail(collect)Formيحدد ما إذا كان النموذج يجمع عناوين البريد الإلكتروني للمستجيبين.
setConfirmationMessage(message)Formتُحدِّد رسالة تأكيد النموذج.
setCustomClosedFormMessage(message)Formتتيح هذه السياسة عرض الرسالة إذا كان النموذج لا يقبل الردود.
setDescription(description)Formلتعيين وصف النموذج.
setDestination(type, id)Formلتحديد الوجهة التي يتم فيها حفظ ردود النموذج.
setIsQuiz(enabled)Formلتحديد ما إذا كان النموذج اختبارًا
setLimitOneResponsePerUser(enabled)Formيحدد ما إذا كان النموذج يسمح فقط برد واحد لكل مجيب.
setProgressBar(enabled)Formتحدِّد هذه السياسة ما إذا كان النموذج يتضمّن شريط تقدّم.
setPublishingSummary(enabled)Formيحدد ما إذا كان النموذج سيعرض رابطًا لعرض ملخص الردود بعد إرسال المستجيب للنموذج.
setRequireLogin(requireLogin)Formيحدد ما إذا كان النموذج يتطلب من المستجيبين تسجيل الدخول إلى حساب في النطاق نفسه أو نطاق فرعي قبل الرد.
setShowLinkToRespondAgain(enabled)Formيحدد ما إذا كان النموذج يعرض رابطًا لإرسال رد آخر بعد إكمال المستجيب للنموذج.
setShuffleQuestions(shuffle)Formتحدّد ما إذا كان ترتيب الأسئلة في كل صفحة من النموذج عشوائيًا.
setTitle(title)Formلضبط عنوان النموذج.
shortenFormUrl(url)Stringتحوِّل عنوان URL الطويل لنموذج إلى عنوان URL قصير.
submitGrades(responses)Formإرسال درجات لـ FormResponses المحددة

الوثائق التفصيلية

addCheckboxGridItem()

لإلحاق عنصر سؤال جديد، يتم تقديمه كشبكة من الأعمدة والصفوف، مما يسمح للمجيب بتحديد خيارات متعددة لكل صف من سلسلة من مربعات الاختيار.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a checkbox grid item.
const item = form.addCheckboxGridItem();

// Sets the title 'Where did you celebrate New Year's?'
item.setTitle('Where did you celebrate New Year's?');

// Sets the grid's rows and columns.
item.setRows(['New York', 'San Francisco', 'London'])
  .setColumns(['2014', '2015', '2016', '2017']);

استرجاع الكرة

CheckboxGridItem — العنصر الذي تم إنشاؤه حديثًا

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addCheckboxItem()

لإرفاق عنصر سؤال جديد يسمح للمجيب بتحديد مربع اختيار واحد أو أكثر، بالإضافة إلى حقل "other" اختياري.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a checkbox item.
const item = form.addCheckboxItem();

// Sets the title of the checkbox item to 'Do you prefer cats or dogs?'
item.setTitle('Do you prefer cats or dogs?');

// Sets the choices.
item.setChoiceValues(['Cats', 'Dogs']);

استرجاع الكرة

CheckboxItem — العنصر الذي تم إنشاؤه حديثًا

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addDateItem()

لإلحاق عنصر جديد بسؤال يسمح للمجيب بالإشارة إلى تاريخ.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a date item.
const item = form.addDateItem();

// Sets the title to 'When were you born?'
item.setTitle('When were you born?');

// Sets the description for the date item.
item.setHelpText('Some helper text.');

استرجاع الكرة

DateItem — العنصر الذي تم إنشاؤه حديثًا

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addDateTimeItem()

لإلحاق عنصر جديد بسؤال يسمح للمجيب بالإشارة إلى التاريخ والوقت.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a question with date and time inputs.
const item = form.addDateTimeItem();

// Sets the title to 'When were you born?'
item.setTitle('When were you born?');

// Sets the question as required.
item.setRequired(true);

استرجاع الكرة

DateTimeItem — العنصر الذي تم إنشاؤه حديثًا

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addDurationItem()

لإلحاق عنصر جديد بسؤال يسمح للمجيب بالإشارة إلى المدة الزمنية.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a question with a duration input.
const item = form.addDurationItem();

// Sets the title to 'How long can you hold your breath?'
item.setTitle('How long can you hold your breath?');

// Sets the question as required.
item.setRequired(true);

استرجاع الكرة

DurationItem — العنصر الذي تم إنشاؤه حديثًا

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addEditor(emailAddress)

لإضافة المستخدم المحدّد إلى قائمة المحرِّرين في Form. إذا كان المستخدم مدرجًا في قائمة المشاهدين، تؤدي هذه الطريقة إلى إزالة المستخدم من قائمة المشاهدين.

المَعلمات

الاسمTypeالوصف
emailAddressStringعنوان البريد الإلكتروني للمستخدم المطلوب إضافته.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addEditor(user)

لإضافة المستخدم المحدّد إلى قائمة المحرِّرين في Form. إذا كان المستخدم مدرجًا في قائمة المشاهدين، تؤدي هذه الطريقة إلى إزالة المستخدم من قائمة المشاهدين.

المَعلمات

الاسمTypeالوصف
userUserتمثيل للمستخدم تتم إضافته.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addEditors(emailAddresses)

لإضافة مجموعة المستخدمين المحدّدة إلى قائمة المحرِّرين في Form. إذا كان أيٌّ من المستخدمين مدرجًا في قائمة المشاهدين، تعمل هذه الطريقة على الترويج له خارج قائمة المشاهدين.

المَعلمات

الاسمTypeالوصف
emailAddressesString[]مصفوفة من عناوين البريد الإلكتروني للمستخدمين المراد إضافتها.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addGridItem()

لإلحاق عنصر سؤال جديد، يتم عرضه كشبكة من الأعمدة والصفوف، مما يسمح للمجيب بتحديد خيار واحد لكل صف من سلسلة من أزرار الاختيار.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a multiple choice grid.
const item = form.addGridItem();

// Sets the title to 'Rate your interests.'
item.setTitle('Rate your interests');

// Sets the grid's rows and columns.
item.setRows(['Cars', 'Computers', 'Celebrities'])
  .setColumns(['Boring', 'So-so', 'Interesting']);

استرجاع الكرة

GridItem — العنصر الذي تم إنشاؤه حديثًا

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addImageItem()

لإلحاق عنصر تنسيق جديد يعرض صورة.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds an image item.
const item = form.addImageItem();

// Gets the Google icon to use as the image.
const img = UrlFetchApp.fetch('https://fonts.gstatic.com/s/i/productlogos/googleg/v6/web-24dp/logo_googleg_color_1x_web_24dp.png');

// Sets the image, title, and description for the item.
item.setTitle('Google icon').setHelpText('Google icon').setImage(img);

استرجاع الكرة

ImageItem — العنصر الذي تم إنشاؤه حديثًا

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addListItem()

لإلحاق عنصر سؤال جديد يسمح للمجيب بتحديد خيار واحد من القائمة المنسدلة.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a dropdown list to the form.
const item = form.addListItem();

// Sets the title to 'Do you prefer cats or dogs?'
item.setTitle('Do you prefer cats or dogs?');

// Sets the description to 'This is description text...'
item.setHelpText('This is description text...');

// Creates and adds choices to the dropdown list.
item.setChoices([
  item.createChoice('dog'),
  item.createChoice('cat')
]);

استرجاع الكرة

ListItem — العنصر الذي تم إنشاؤه حديثًا

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addMultipleChoiceItem()

إضافة عنصر سؤال جديد يسمح للمجيب بتحديد خيار واحد من قائمة أزرار الاختيار أو حقل "other" اختياري.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a multiple choice item to the form.
const item = form.addMultipleChoiceItem();

// Sets the title.
item.setTitle('What is your favorite ice cream flavor?');

// Creates some choice items.
const vanilla = item.createChoice('vanilla');
const chocolate = item.createChoice('chocolate');
const strawberry = item.createChoice('strawberry');

// Sets the choices.
item.setChoices([vanilla, chocolate, strawberry]);

استرجاع الكرة

MultipleChoiceItem — العنصر الذي تم إنشاؤه حديثًا

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addPageBreakItem()

لإضافة عنصر تنسيق جديد يمثّل بداية صفحة.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds page break items to create a second and third page for the form.
const pageTwo = form.addPageBreakItem();
const pageThree = form.addPageBreakItem();

// Sets the titles for the pages.
pageTwo.setTitle('Page two');
pageThree.setTitle('Page three');

// Upon completion of the first page, sets the form to navigate to the third page.
pageTwo.setGoToPage(pageThree);

// Upon completion of the second page, sets the form to navigate back to the first page.
pageThree.setGoToPage(FormApp.PageNavigationType.RESTART);

استرجاع الكرة

PageBreakItem — العنصر الذي تم إنشاؤه حديثًا

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addParagraphTextItem()

لإضافة عنصر سؤال جديد يسمح للمجيب بإدخال جزء من النص.

// Opens the form by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds the paragraph text item.
const item = form.addParagraphTextItem();

// Sets the title to 'What is your address?'
item.setTitle('What is your address?');

استرجاع الكرة

ParagraphTextItem — العنصر الذي تم إنشاؤه حديثًا

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addScaleItem()

لإلحاق عنصر جديد بسؤال يسمح للمجيب بتحديد خيار واحد من تسلسل مرقّم لأزرار الاختيار.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds the scale item.
const item = form.addScaleItem();

// Sets the title of the scale item to 'Choose a number.'
item.setTitle('Choose a number');

// Sets the scale to 1-5.
item.setBounds(1, 5);

// Sets the label for the lower and upper bounds.
item.setLabels('Lowest', 'Highest');

استرجاع الكرة

ScaleItem — العنصر الذي تم إنشاؤه حديثًا

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addSectionHeaderItem()

لإلحاق عنصر تنسيق جديد يشير بصريًا إلى بداية القسم.

 // Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds the section heading item.
const item = form.addSectionHeaderItem();

// Sets the title to 'Title of new section.'
item.setTitle('Title of new section');

// Sets the description.
item.setHelpText('Description of new section');

استرجاع الكرة

SectionHeaderItem — العنصر الذي تم إنشاؤه حديثًا

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addTextItem()

لإلحاق عنصر جديد بسؤال يسمح للمجيب بإدخال سطر واحد من النص.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a single-line text item.
const item = form.addTextItem();

// Sets the title to 'What is your name?'
item.setTitle('What is your name?');

استرجاع الكرة

TextItem — العنصر الذي تم إنشاؤه حديثًا

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addTimeItem()

لإلحاق عنصر جديد بسؤال يسمح للمجيب بالإشارة إلى وقت من اليوم.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a question with a time input.
const item = form.addTimeItem();

// Sets the title to 'What time do you usually wake up in the morning?'
item.setTitle('What time do you usually wake up in the morning?');

استرجاع الكرة

TimeItem — العنصر الذي تم إنشاؤه حديثًا

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

addVideoItem()

لإلحاق عنصر تنسيق جديد يعرض فيديو.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Adds a video item.
const item = form.addVideoItem();

// Sets the title, description, and video.
item.setTitle('YouTube video')
  .setHelpText('Send content automatically via Google Sheets and Apps Script')
  .setVideoUrl('https://youtu.be/xxgQr-jSu9o');

// Sets the alignment to the center.
item.setAlignment(FormApp.Alignment.CENTER);

استرجاع الكرة

VideoItem — العنصر الذي تم إنشاؤه حديثًا

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

canEditResponse()

يحدد ما إذا كان النموذج يعرض رابطًا لتعديل الرد بعد إرساله.

بغض النظر عن هذا الإعداد، تسمح الطريقة FormResponse.getEditResponseUrl() لمؤلف النص البرمجي الذي لديه الإذن بتعديل النموذج لإنشاء عنوان URL يمكن استخدامه لتعديل الردّ.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Checks if the form displays a link to edit a response after submitting it.
// The default is false. To let people edit their responses, use
// form.setAllowResponseEdits(true).
const edit = form.canEditResponse();

// If the form doesn't let people edit responses, logs false to the console.
console.log(edit);

استرجاع الكرة

Boolean - true إذا كان النموذج يعرض رابط "تعديل ردّك"، وfalse إذا لم يعرضه

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

collectsEmail()

يحدد ما إذا كان النموذج يجمع عناوين البريد الإلكتروني للمستجيبين.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to not collect respondents' email addresses.
form.setCollectEmail(false);

// Checks whether the form collects respondents' email addresses and logs it to the console.
const bool = form.collectsEmail();

console.log(bool);

استرجاع الكرة

Boolean - true إذا كان النموذج يجمع عناوين البريد الإلكتروني، وfalse إذا لم يجمع عناوين البريد الإلكتروني

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

createResponse()

ينشئ ردًا جديدًا على النموذج. للإجابة عن عنصر سؤال، أنشئ ItemResponse من العنصر، ثم أرفِقه برد النموذج هذا عن طريق استدعاء FormResponse.withItemResponse(response). لحفظ الردّ المجمّع، يُرجى طلب FormResponse.submit().

استرجاع الكرة

FormResponse — الرد على النموذج الذي تم إنشاؤه حديثًا

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

deleteAllResponses()

لحذف جميع الردود المرسلة من مخزن ردود النموذج. لا تحذف هذه الطريقة نُسخ الردود المخزنة في وجهة استجابة خارجية (مثل جدول البيانات)، ولكنها تمحو عرض ملخص النموذج.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

deleteItem(index)

حذف العنصر في فهرس محدد بين جميع العناصر في النموذج. تطرح استثناء برمجة نصية إذا لم يوجد أي عنصر في الفهرس المحدد.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets all the items from the form.
const items = form.getItems();

// Finds the index of a paragraph text item and deletes it by the item's index.
const index = items.findIndex(item => item.getType() === FormApp.ItemType.PARAGRAPH_TEXT);
if (index !== -1) {
  form.deleteItem(index);
}

المَعلمات

الاسمTypeالوصف
indexIntegerفهرس العنصر بين جميع العناصر في النموذج.

الرميات

Error: في حال عدم توفُّر أي عنصر في الفهرس المحدّد

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

deleteItem(item)

يؤدي هذا الإجراء إلى حذف العنصر المحدّد. تعرض استثناء برمجة نصية إذا تم حذف العنصر من قبل.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets all of the items from the form.
const items = form.getItems();

// Finds a paragraph text item and deletes it.
const item = items.find(item => item.getType() === FormApp.ItemType.PARAGRAPH_TEXT);
if (item) {
  form.deleteItem(item);
}

المَعلمات

الاسمTypeالوصف
itemItemالعنصر المطلوب حذفه.

الرميات

Error: في حال عدم توفُّر السلعة في النموذج

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

deleteResponse(responseId)

حذف رد واحد من مخزن الردود في النموذج لا تحذف هذه الطريقة نُسخًا من الردود المخزّنة في وجهة استجابة خارجية (مثل جدول البيانات)، لكنّها تزيل الرد من عرض ملخّص النموذج. يمكن استرداد رقم تعريف الردّ باستخدام FormResponse.getId().

المَعلمات

الاسمTypeالوصف
responseIdStringرقم تعريف الرد على النموذج المطلوب حذفه.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getConfirmationMessage()

يتلقّى رسالة تأكيد النموذج.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the confirmation message to display after someone submits the form.
form.setConfirmationMessage('You successfully submitted the form.');

// Gets the confirmation message and logs it to the console.
const message = form.getConfirmationMessage();

console.log(message);

استرجاع الكرة

String — رسالة تأكيد النموذج

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getCustomClosedFormMessage()

يتلقى هذا الإعداد الرسالة المخصّصة التي يتم عرضها إذا كان النموذج لا يقبل الردود، أو سلسلة فارغة في حال عدم ضبط أي رسالة مخصّصة.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets a custom closed form message to display to the user when the form
// no longer accepts responses.
form.setCustomClosedFormMessage('The form is no longer accepting responses.');

// Gets the custom message set for the form and logs it to the console.
const message = form.getCustomClosedFormMessage();

console.log(message);

استرجاع الكرة

String: الرسالة المخصّصة التي يتم عرضها إذا كان النموذج لا يقبل الردود، أو سلسلة فارغة في حال عدم ضبط أي رسالة مخصّصة.

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getDescription()

الحصول على وصف النموذج

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form description.
form.setDescription('This is the form description.');

// Gets the form description and logs it to the console.
const description = form.getDescription();

console.log(description);

استرجاع الكرة

String — وصف النموذج

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getDestinationId()

الحصول على رقم تعريف وجهة الرد على النموذج

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Creates a spreadsheet to use as the response destination.
const ss = SpreadsheetApp.create('Test_Spreadsheet');

// Updates the form's response destination.
form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());

// Gets the ID of the form's response destination and logs it to the console.
const destinationId = form.getDestinationId();

console.log(destinationId);

استرجاع الكرة

String - رقم تعريف وجهة الرد على النموذج

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getDestinationType()

معرفة نوع وجهة الرد على النموذج

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc1234556/edit');

// Gets the type of the form's response destination and logs it to the console.
const destinationType = form.getDestinationType().name();

console.log(destinationType);

استرجاع الكرة

DestinationType — نوع وجهة الرد على النموذج

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getEditUrl()

الحصول على عنوان URL الذي يمكن استخدامه للوصول إلى وضع التعديل في النموذج

// Opens the form by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the URL that accesses the form's edit mode and logs it to the console.
const url = form.getEditUrl();

console.log(url);

استرجاع الكرة

String: عنوان URL لتعديل النموذج

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getEditors()

يمكنك الحصول على قائمة بالمحرِّرين في Form.

استرجاع الكرة

User[] - مصفوفة من المستخدمين الذين لديهم إذن بالتعديل.

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getId()

الحصول على رقم تعريف النموذج.

// Opens the form by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the ID of the form and logs it to the console.
const id = form.getId();

console.log(id);

استرجاع الكرة

String - رقم تعريف النموذج

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getItemById(id)

الحصول على العنصر بمعرّف محدَّد. تعرض null إذا كان المعرّف لا يتوافق مع عنصر في النموذج.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the ID of the first item on the form.
const itemId = form.getItems()[0].getId();

// Gets the item from the ID.
const item = form.getItemById(itemId);

// Gets the name of the item type and logs it to the console.
const type = item.getType().name();

console.log(type);

المَعلمات

الاسمTypeالوصف
idIntegerمعرّف العنصر.

استرجاع الكرة

Item - العنصر الذي يحمل المعرّف المحدّد، أو null إذا لم يكن العنصر متوفّرًا في النموذج

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getItems()

الحصول على مصفوفة من جميع العناصر في النموذج

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the list of items in the form.
const items = form.getItems();

// Gets the type for each item and logs them to the console.
const types = items.map((item) => item.getType().name());

console.log(types);

استرجاع الكرة

Item[]: مصفوفة من جميع العناصر في النموذج.

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getItems(itemType)

تحصل على مصفوفة من جميع العناصر من نوع معيّن.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets a list of all checkbox items on the form.
const items = form.getItems(FormApp.ItemType.CHECKBOX);

// Gets the title of each checkbox item and logs them to the console.
const checkboxItemsTitle = items.map((item) => item.asCheckboxItem().getTitle());
console.log(checkboxItemsTitle);

المَعلمات

الاسمTypeالوصف
itemTypeItemTypeنوع العناصر المطلوب استردادها.

استرجاع الكرة

Item[]: مصفوفة من كل العناصر من هذا النوع.

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getPublishedUrl()

الحصول على عنوان URL الذي يمكن استخدامه للردّ على النموذج

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the URL to respond to the form and logs it to the console.
const url = form.getPublishedUrl();
console.log(url);

استرجاع الكرة

String: عنوان URL للردّ على النموذج

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getResponse(responseId)

يتلقى ردًا من نموذج واحد استنادًا إلى رقم تعريف الرد الخاص به. يمكن استرداد أرقام تعريف الردود من "FormResponse.getId()".

المَعلمات

الاسمTypeالوصف
responseIdStringرقم تعريف استجابة النموذج.

استرجاع الكرة

FormResponse — الرد على النموذج

الرميات

Error: في حال عدم توفّر الردّ

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getResponses()

الحصول على مصفوفة من جميع الردود في النموذج

استرجاع الكرة

FormResponse[]: مصفوفة من جميع ردود النموذج.

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getResponses(timestamp)

الحصول على مصفوفة من جميع ردود النموذج بعد تاريخ ووقت معيّنَين

المَعلمات

الاسمTypeالوصف
timestampDateأقرب تاريخ ووقت يجب عرض ردود النموذج خلاله.

استرجاع الكرة

FormResponse[] - قائمة بالردود على النموذج

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getShuffleQuestions()

تحدد ما إذا كان ترتيب الأسئلة في كل صفحة من النموذج عشوائيًا.

استرجاع الكرة

Boolean - true إذا كان ترتيب الأسئلة في كل صفحة من النموذج عشوائيًا، أو false إذا لم يكن الأمر كذلك.

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getSummaryUrl()

الحصول على عنوان URL الذي يمكن استخدامه لعرض ملخّص الردود على النموذج ما لم يتم ضبط setPublishingSummary(enabled) على true، لن يتمكن سوى المستخدمين الذين لديهم إذن تعديل للنموذج من الوصول إلى عنوان URL.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// Opens the form by its URL.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the URL to view a summary of the form's responses and logs it to the console.
const url = form.getSummaryUrl();
console.log(url);

استرجاع الكرة

String: عنوان URL لعرض ملخّص الردود

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

getTitle()

للحصول على عنوان النموذج.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the title of the form to 'For_Testing.'
form.setTitle('For_Testing');

// Gets the title of the form and logs it to the console.
const title = form.getTitle();
console.log(title);

استرجاع الكرة

String — عنوان النموذج

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

hasLimitOneResponsePerUser()

يحدد ما إذا كان النموذج يسمح بإجابة واحدة فقط لكل مجيب. إذا كانت القيمة هي true، لن يتمكن النص البرمجي من إرسال الردود على النموذج على الإطلاق.

استرجاع الكرة

من Boolean إلى true إذا كان النموذج يسمح بردّ واحد فقط لكل مجيب، وfalse إذا لم يكن متاحًا.

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

hasProgressBar()

تحدِّد هذه السياسة ما إذا كان النموذج يعرض شريط تقدّم.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// Opens the form by its URL.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Displays the progress bar on the form.
form.setProgressBar(true);

// Checks if the form displays a progress bar and logs it to the console.
console.log(form.hasProgressBar());

استرجاع الكرة

Boolean: true إذا كان النموذج يعرض شريط تقدّم، وfalse إذا لم يعرضه

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

تحدد ما إذا كان النموذج يعرض رابطًا لإرسال رد آخر بعد إكمال المستجيب للنموذج.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to display a link to submit another
// response after someone submits the form.
form.setShowLinkToRespondAgain(true);

// Checks if the form displays a 'Submit another response' link and logs it to the console.
console.log(form.hasRespondAgainLink());

استرجاع الكرة

Boolean: true إذا كان النموذج يعرض الرابط "إرسال ردّ آخر"، وfalse إذا لم يعرض هذا الرابط

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

isAcceptingResponses()

تحدِّد هذه السياسة ما إذا كان النموذج يقبل الردود حاليًا.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to accept responses.
form.setAcceptingResponses(true);

// Checks if the form is accepting responses or not and logs it to the console.
const accepting = form.isAcceptingResponses();
console.log(accepting);

استرجاع الكرة

Boolean: true إذا كان النموذج يقبل الردود، وfalse إذا لم يقبل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

isPublishingSummary()

تحدد ما إذا كان النموذج يعرض رابطًا لعرض ملخص الردود بعد إكمال المستجيب للنموذج.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to display a link to a summary of
// the responses after someone submits the form.
form.setPublishingSummary(true);

// Checks if the form displays a "See previous responses" link and logs it to the console.
const publishingLink = form.isPublishingSummary();
console.log(publishingLink);

استرجاع الكرة

Boolean: true إذا كان النموذج يعرض الرابط "الاطّلاع على الردود السابقة"، وfalse إذا لم يعرضه

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

isQuiz()

تحدد ما إذا كان النموذج اختبارًا.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form as a quiz.
form.setIsQuiz(true);

// Checks if the form is a quiz or not and logs it to the console.
console.log(form.isQuiz());

استرجاع الكرة

Boolean: true إذا كان النموذج يقبل الردود، وfalse إذا لم يقبل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

moveItem(from, to)

لنقل عنصر في فهرس معين بين جميع العناصر في النموذج إلى فهرس محدد آخر. توفّر استثناء نصوص برمجية إذا كان فهرس to خارج الحدود.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Moves the first item to be the last item.
form.moveItem(0, form.getItems().length - 1);

المَعلمات

الاسمTypeالوصف
fromIntegerالفهرس الحالي للسلعة من بين جميع العناصر في النموذج.
toIntegerالفهرس الجديد للعنصر من بين جميع العناصر في النموذج.

استرجاع الكرة

Item — العنصر الذي تم نقله

الرميات

Error: إذا كان أي من الفهرسَين خارج الحدود.

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

moveItem(item, toIndex)

لنقل عنصر معين إلى فهرس محدد بين جميع العناصر في النموذج. يوفر استثناء برمجة نصية إذا كان الفهرس المحدد خارج الحدود.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Gets the first item.
const item = form.getItems()[0];

// Moves the item to be the last item.
form.moveItem(item, form.getItems().length - 1);

المَعلمات

الاسمTypeالوصف
itemItemالعنصر المطلوب نقله
toIndexIntegerالفهرس الجديد للعنصر من بين جميع العناصر في النموذج.

استرجاع الكرة

Item — العنصر الذي تم نقله

الرميات

Error: إذا كان الفهرس خارج الحدود.

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

removeDestination()

إلغاء ربط النموذج بوجهة الرد الحالية. لا تزال الوجهة السابقة التي تم إلغاء ربطها تحتفظ بنسخة من جميع الردود السابقة. جميع النماذج، بما في ذلك النماذج التي لم يتم تحديد وجهة لها بشكل صريح، احفظ نسخة من الردود في مخزن استجابة النموذج. إذا لم يكن للنموذج وجهة استجابة حاليًا، لن يكون لهذه الطريقة أي تأثير.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Opens a spreadsheet to use for the response destination.
// TODO(developer): Replace the URL with your own.
const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/abc123456/edit');

// Updates the form's response destination to the spreadsheet.
form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());

// Unlinks the form from the spreadsheet.
form.removeDestination();

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

removeEditor(emailAddress)

لإزالة المستخدم المحدّد من قائمة المحرِّرين في Form. ولا تحظر هذه الطريقة المستخدمين من الوصول إلى Form إذا كانوا ينتمون إلى فئة من المستخدمين الذين لديهم إذن وصول عام، مثلاً إذا تمت مشاركة Form مع نطاق المستخدم بأكمله، أو إذا كانت Form في مساحة تخزين سحابي مشتركة يمكن للمستخدم الوصول إليها.

بالنسبة إلى ملفات Drive، سيؤدي هذا أيضًا إلى إزالة المستخدم من قائمة العارضين.

المَعلمات

الاسمTypeالوصف
emailAddressStringعنوان البريد الإلكتروني للمستخدم المطلوب إزالته.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

removeEditor(user)

لإزالة المستخدم المحدّد من قائمة المحرِّرين في Form. ولا تحظر هذه الطريقة المستخدمين من الوصول إلى Form إذا كانوا ينتمون إلى فئة من المستخدمين الذين لديهم إذن وصول عام، مثلاً إذا تمت مشاركة Form مع نطاق المستخدم بأكمله، أو إذا كانت Form في مساحة تخزين سحابي مشتركة يمكن للمستخدم الوصول إليها.

بالنسبة إلى ملفات Drive، سيؤدي هذا أيضًا إلى إزالة المستخدم من قائمة العارضين.

المَعلمات

الاسمTypeالوصف
userUserتمثيل للمستخدم المطلوب إزالته.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

requiresLogin()

يحدد ما إذا كان النموذج يتطلب من المستجيبين تسجيل الدخول إلى حساب في النطاق نفسه أو في نطاق فرعي قبل الاستجابة.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Checks if the form requires respondents to log in to a Google Workspace account
// before responding and logs it to the console.
const login = form.requiresLogin();
console.log(login);

استرجاع الكرة

Boolean: true إذا كان النموذج يتطلّب من المستخدمين تسجيل الدخول، وfalse إذا لم يكن يتم تسجيل الدخول


setAcceptingResponses(enabled)

لتحديد ما إذا كان النموذج يقبل الردود حاليًا أم لا. الإعداد التلقائي للنماذج الجديدة هو true.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to accept responses.
form.setAcceptingResponses(true);

// Checks whether the form is accepting responses or not and logs it to the console.
console.log(form.isAcceptingResponses());

المَعلمات

الاسمTypeالوصف
enabledBooleantrue إذا كان يجب أن يقبل النموذج الردود، وfalse إذا لم يكن كذلك.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setAllowResponseEdits(enabled)

يحدد ما إذا كان النموذج سيعرض رابطًا لتعديل الرد بعد إرساله. الإعداد التلقائي للنماذج الجديدة هو false

بغض النظر عن هذا الإعداد، تسمح الطريقة FormResponse.getEditResponseUrl() لمؤلف النص البرمجي الذي لديه إذن تعديل النموذج بإنشاء عنوان URL يمكن استخدامه لتعديل الردّ.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Shows "Edit your response" link after someone submits the form.
form.setAllowResponseEdits(true);

// Checks whether the option to edit the form after a user submits it is set to true or not
// and logs it to the console.
console.log(form.canEditResponse());

المَعلمات

الاسمTypeالوصف
enabledBooleantrue إذا كان يجب أن يعرض النموذج الرابط "تعديل ردك"، وfalse إذا لم يكن كذلك.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setCollectEmail(collect)

يحدد ما إذا كان النموذج يجمع عناوين البريد الإلكتروني للمستجيبين. الإعداد التلقائي للنماذج الجديدة هو false.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to collect respondents' email addresses.
form.setCollectEmail(true);

// Checks whether the value is set to true or false and logs it to the console.
const collect = form.collectsEmail();
console.log(collect);

المَعلمات

الاسمTypeالوصف
collectBooleantrue إذا كان النموذج يجب أن يجمع عناوين البريد الإلكتروني، وfalse إذا لم يكن يجمع عناوين البريد الإلكتروني.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setConfirmationMessage(message)

تُحدِّد رسالة تأكيد النموذج.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets a custom confirmation message to display after someone submits the form.
form.setConfirmationMessage('Your form has been successfully submitted.');

// Gets the confirmation message set for the form and logs it to the console.
const message = form.getConfirmationMessage();
console.log(message);

المَعلمات

الاسمTypeالوصف
messageStringرسالة التأكيد الجديدة في النموذج.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setCustomClosedFormMessage(message)

تتيح هذه السياسة عرض الرسالة إذا كان النموذج لا يقبل الردود. إذا لم يتم ضبط أي رسالة، سيستخدم النموذج رسالة تلقائية.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form to not accept responses.
form.setAcceptingResponses(false);

// Sets a custom closed form message to display to the user.
form.setCustomClosedFormMessage('The form is no longer accepting responses.');

// Gets the custom message set for the form and logs it to the console.
const message = form.getCustomClosedFormMessage();
console.log(message);

المَعلمات

الاسمTypeالوصف
messageStringالرسالة التي يتم عرضها إذا كان النموذج لا يقبل الردود.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setDescription(description)

لتعيين وصف النموذج.

المَعلمات

الاسمTypeالوصف
descriptionStringالوصف الجديد للنموذج

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setDestination(type, id)

لتحديد الوجهة التي يتم فيها حفظ ردود النموذج. احفظ نسخة من الردود في مخزن ردود النموذج على جميع النماذج، بما في ذلك النماذج التي لم يتم تحديد وجهة لها بشكل صريح.

المَعلمات

الاسمTypeالوصف
typeDestinationTypeنوع وجهة الرد على النموذج
idStringرقم التعريف لوجهة استجابة النموذج.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

الرميات

Error: إذا كان رقم تعريف الوجهة المحدّد غير صالح

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setIsQuiz(enabled)

لتحديد ما إذا كان النموذج اختبارًا الإعداد التلقائي للنماذج الجديدة هو false.

لا يُسمح بالأسئلة المقيّمة إلا في "الاختبارات"، لذا يؤدي ضبط هذا الإعداد على false إلى إزالة جميع خيارات وضع الدرجات من كل الأسئلة.

لا تتوفر إعدادات الاختبار إلا في واجهة مستخدم "نماذج Google" الجديدة، فإنشاء نموذج في الاختبار يؤدي إلى تفعيل النموذج باستخدام واجهة المستخدم الجديدة.

// Opens the Forms file by its URL. If you created your script from within a
// Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Makes the form a quiz.
form.setIsQuiz(true);

// Checks whether the form is a quiz or not and logs it to the console.
console.log(form.isQuiz());

المَعلمات

الاسمTypeالوصف
enabledBooleantrue إذا كان يجب تفعيل ميزات الاختبار للنموذج، وfalse إذا لم تكن كذلك.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setLimitOneResponsePerUser(enabled)

يحدد ما إذا كان النموذج يسمح فقط برد واحد لكل مجيب. الإعداد التلقائي للنماذج الجديدة هو false. إذا تم ضبط القيمة على true، لن يتمكن النص البرمجي من إرسال الردود على النموذج إطلاقًا.

المَعلمات

الاسمTypeالوصف
enabledBooleantrue إذا كان النموذج يجب أن يسمح بردّ واحد فقط لكل مجيب، وfalse إذا لم يكن كذلك.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setProgressBar(enabled)

تحدِّد هذه السياسة ما إذا كان النموذج يتضمّن شريط تقدّم. الإعداد التلقائي للنماذج الجديدة هو false.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Displays the progress bar on the form.
form.setProgressBar(true);

// Checks whether the form has a progress bar and logs it to the console.
console.log(form.hasProgressBar());

المَعلمات

الاسمTypeالوصف
enabledBooleantrue إذا كان النموذج يعرض شريط تقدم، وfalse إذا لم يعرضه

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setPublishingSummary(enabled)

يحدد ما إذا كان النموذج سيعرض رابطًا لعرض ملخص الردود بعد إرسال المستجيب للنموذج. الإعداد التلقائي للنماذج الجديدة هو false.

المَعلمات

الاسمTypeالوصف
enabledBooleantrue إذا كان يجب أن يعرض النموذج الرابط "الاطّلاع على الردود السابقة"، وfalse إذا لم يكن مطلوبًا.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setRequireLogin(requireLogin)

يحدد ما إذا كان النموذج يتطلب من المستجيبين تسجيل الدخول إلى حساب في النطاق نفسه أو نطاق فرعي قبل الرد. الإعداد التلقائي للنماذج الجديدة هو false ما لم يغيِّر مشرف النطاق الإعداد التلقائي.

لا تتوفر هذه الميزة إلا للنماذج التي ينشئها مستخدمو Google Workspace. ولا يمكن مطالبة المستخدمين من الأنواع الأخرى من حسابات Google بتسجيل الدخول.

// Opens the Forms file by its URL. If you created your script from within
// a Google Forms file, you can use FormApp.getActiveForm() instead.
// TODO(developer): Replace the URL with your own.
const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');

// Sets the form so that users must log in to their Google Workspace account.
form.setRequireLogin(true);

// Checks whether the form requires login or not and logs it to the console.
console.log(form.requiresLogin());

المَعلمات

الاسمTypeالوصف
requireLoginBooleantrue إذا كان النموذج يتطلب من المستخدمين تسجيل الدخول، وfalse إذا لم يكن يتم تسجيل الدخول.

استرجاع الكرة

Form - النموذج الحالي (للسلاسل)

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setShowLinkToRespondAgain(enabled)

يحدد ما إذا كان النموذج يعرض رابطًا لإرسال رد آخر بعد إكمال المستجيب للنموذج. الإعداد التلقائي للنماذج الجديدة هو true.

المَعلمات

الاسمTypeالوصف
enabledBooleantrue إذا كان يجب أن يعرض النموذج الرابط "إرسال رد آخر"، وfalse إذا لم يكن كذلك.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setShuffleQuestions(shuffle)

تحدّد ما إذا كان ترتيب الأسئلة في كل صفحة من النموذج عشوائيًا.

المَعلمات

الاسمTypeالوصف
shuffleBooleantrue إذا كان يجب ترتيب الأسئلة في كل صفحة من النموذج عشوائيًا، أو false إذا لم يكن الأمر كذلك.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

setTitle(title)

لضبط عنوان النموذج.

المَعلمات

الاسمTypeالوصف
titleStringالعنوان الجديد للنموذج

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

shortenFormUrl(url)

تحوِّل عنوان URL الطويل لنموذج إلى عنوان URL قصير. توفّر استثناءً إذا كان عنوان URL الطويل لا ينتمي إلى "نماذج Google".

المَعلمات

الاسمTypeالوصف
urlStringعنوان URL المطلوب تقصيره.

استرجاع الكرة

String: عنوان URL بالتنسيق http://goo.gl/forms/1234.

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms

submitGrades(responses)

إرسال درجات لـ FormResponses المحددة

إذا كان الرمز يتضمّن مشغِّل onFormSubmit، يؤدي استدعاء submitGrades() إلى تشغيل الشرط onFormSubmit وإنشاء حلقة لانهائية. لمنع التكرار اللانهائي، أضِف رمزًا يتحقّق مما إذا كانت الدرجات متوفّرة قبل استدعاء submitGrades().

المَعلمات

الاسمTypeالوصف
responsesFormResponse[]مصفوفة من جميع ردود النموذج.

استرجاع الكرة

Form - جهاز Form هذا للسلاسل

التفويض

تتطلب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على تفويض باستخدام واحد أو أكثر من النطاقات التالية:

  • https://www.googleapis.com/auth/forms.currentonly
  • https://www.googleapis.com/auth/forms