نموذج يحتوي على خصائص وعناصر شاملة. وتشمل الخصائص العنوان والإعدادات ومكان تخزين الردود. تشمل العناصر عناصر الأسئلة، مثل مربّعات الاختيار أو عناصر الاختيار، بينما تشير عناصر التنسيق إلى أشياء مثل فواصل الصفحات. يمكن الوصول إلى النماذج أو إنشاؤها من FormApp.
// Open a form by ID and create a new spreadsheet. const form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); const 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());
الطُرق
| الطريقة | نوع القيمة التي تم إرجاعها | وصف قصير |
|---|---|---|
add | Checkbox | تُلحق هذه السمة عنصر سؤال جديدًا، ويتم عرضه كشبكة من الأعمدة والصفوف، ما يتيح للمستجيب تحديد خيارات متعدّدة لكل صف من سلسلة مربّعات الاختيار. |
add | Checkbox | تضيف هذه الطريقة عنصر سؤال جديدًا يتيح للمستجيب اختيار مربّع اختيار واحد أو أكثر، بالإضافة إلى حقل "غير ذلك" اختياري. |
add | Date | تُلحق هذه الطريقة عنصر سؤال جديدًا يتيح للمستجيب تحديد تاريخ. |
add | Date | تُلحق هذه الطريقة عنصر سؤال جديدًا يتيح للمستجيب تحديد تاريخ ووقت. |
add | Duration | تُلحق هذه الطريقة عنصر سؤال جديدًا يتيح للمستجيب تحديد مدة زمنية. |
add | Form | تضيف هذه الطريقة المستخدم المحدّد إلى قائمة المحرّرين في Form. |
add | Form | تضيف هذه الطريقة المستخدم المحدّد إلى قائمة المحرّرين في Form. |
add | Form | تضيف هذه الطريقة مصفوفة المستخدمين المحدّدة إلى قائمة المحرّرين في Form. |
add | Grid | تضيف هذه الطريقة عنصر سؤال جديدًا يتم عرضه كشبكة من الأعمدة والصفوف، ما يتيح للمستجيب اختيار خيار واحد لكل صف من سلسلة أزرار الاختيار. |
add | Image | تُلحق هذه السمة عنصر تخطيط جديدًا يعرض صورة. |
add | List | تُلحق هذه الطريقة عنصر سؤال جديدًا يتيح للمستجيب اختيار خيار واحد من قائمة منسدلة. |
add | Multiple | يضيف عنصر سؤال جديدًا يتيح للمستجيب اختيار خيار واحد من قائمة أزرار اختيار أو حقل "غير ذلك" اختياري. |
add | Page | تضيف هذه السمة عنصر تخطيط جديدًا يحدّد بداية الصفحة. |
add | Paragraph | تضيف هذه السمة عنصر سؤال جديدًا يتيح للمستجيب إدخال فقرة نصية. |
add | Form | تضيف هذه الطريقة المستخدم المحدّد إلى قائمة المستجيبين لـ Form. |
add | Form | تضيف هذه الطريقة المستخدم المحدّد إلى قائمة المستجيبين لـ Form. |
add | Form | تضيف هذه الطريقة مصفوفة المستخدمين المحدّدة إلى قائمة المستجيبين لـ Form. |
add | Rating | تضيف هذه الطريقة عنصر سؤال جديدًا يتيح للمجيب تقديم تقييم. |
add | Scale | تضيف هذه الطريقة عنصر سؤال جديدًا يتيح للمستجيب اختيار خيار واحد من تسلسل مرقّم من أزرار الاختيار. |
add | Section | تُلحق هذه السمة عنصر تخطيط جديدًا يشير بصريًا إلى بداية قسم. |
add | Text | تُلحق هذه السمة عنصر سؤال جديدًا يتيح للمستجيب إدخال سطر واحد من النص. |
add | Time | تضيف هذه الطريقة عنصر سؤال جديدًا يتيح للمستجيب تحديد وقت من اليوم. |
add | Video | تضيف هذه السمة عنصر تصميم جديدًا يعرض فيديو. |
can | Boolean | تحدّد ما إذا كان النموذج يعرض رابطًا لتعديل الردّ بعد إرساله. |
collects | Boolean | تحدّد ما إذا كان النموذج يجمع عناوين البريد الإلكتروني للمستجيبين. |
create | Form | تنشئ هذه الطريقة ردًا جديدًا على النموذج. |
delete | Form | يحذف هذا الإجراء جميع الردود المُرسَلة من مستودع الردود في النموذج. |
delete | void | لحذف العنصر في فهرس معيّن من بين جميع العناصر في النموذج |
delete | void | يحذف العنصر المحدّد. |
delete | Form | يحذف هذا الإجراء ردًا واحدًا من مستودع الردود في النموذج. |
get | String | تعرض هذه السمة رسالة تأكيد النموذج. |
get | String | تعرض هذه الطريقة الرسالة المخصّصة التي تظهر إذا كان النموذج لا يقبل الردود، أو تعرض سلسلة فارغة إذا لم يتم ضبط أي رسالة مخصّصة. |
get | String | تعرض هذه السمة وصف النموذج. |
get | String | يحصل على رقم تعريف وجهة الردّ على النموذج. |
get | Destination | تعرض هذه السمة نوع وجهة الردّ في النموذج. |
get | String | تعرض هذه الطريقة عنوان URL الذي يمكن استخدامه للوصول إلى وضع تعديل النموذج. |
get | User[] | تعرض هذه الطريقة قائمة بالمحرّرين لـ Form. |
get | String | تعرض هذه الطريقة رقم تعريف النموذج. |
get | Item|null | تعرض هذه الطريقة السلعة التي تحمل رقم تعريف معيّنًا. |
get | Item[] | تعرض هذه الطريقة مصفوفة تتضمّن جميع العناصر في النموذج. |
get | Item[] | تعرض هذه الدالة صفيفًا يتضمّن جميع العناصر من نوع معيّن. |
get | User[] | تعرض هذه الطريقة قائمة المجيبين عن Form. |
get | String | تعرض هذه الدالة عنوان URL الذي يمكن استخدامه للردّ على النموذج. |
get | Form | يحصل على ردّ واحد على نموذج استنادًا إلى رقم تعريف الردّ. |
get | Form | تعرض هذه الطريقة مصفوفة تتضمّن جميع الردود على النموذج. |
get | Form | تعرض هذه الدالة مصفوفة تتضمّن جميع ردود النموذج بعد تاريخ ووقت محدّدَين. |
get | Boolean | تحدّد هذه السمة ما إذا كان ترتيب الأسئلة على كل صفحة من النموذج عشوائيًا. |
get | String | تعرض هذه الدالة عنوان URL الذي يمكن استخدامه لعرض ملخّص لردود النموذج. |
get | String | تعرض هذه الدالة عنوان النموذج. |
has | Boolean | تحدِّد ما إذا كان النموذج يسمح بردّ واحد فقط لكل مستجيب. |
has | Boolean | تحدِّد هذه السمة ما إذا كان النموذج يعرض شريط تقدّم. |
has | Boolean | تحدّد ما إذا كان النموذج يعرض رابطًا لإرسال رد آخر بعد أن يكمل المجيب النموذج. |
is | Boolean | تحدّد ما إذا كان النموذج يقبل الردود حاليًا. |
is | Boolean | تحدِّد هذه السمة ما إذا كان النموذج منشورًا. |
is | Boolean | تحدّد ما إذا كان النموذج يعرض رابطًا للاطّلاع على ملخّص الردود بعد أن يكمل المجيب النموذج. |
is | Boolean | تحدّد هذه السمة ما إذا كان النموذج اختبارًا. |
move | Item | تنقل هذه الدالة عنصرًا في فهرس معيّن بين جميع العناصر في النموذج إلى فهرس آخر معيّن. |
move | Item | تنقل هذه السمة عنصرًا معيّنًا إلى فهرس معيّن بين جميع العناصر في النموذج. |
remove | Form | لإلغاء ربط النموذج بوجهة الرد الحالية |
remove | Form | تزيل هذه الطريقة المستخدم المحدّد من قائمة المحرّرين في Form. |
remove | Form | تزيل هذه الطريقة المستخدم المحدّد من قائمة المحرّرين في Form. |
remove | Form | يزيل هذا الإجراء المستخدم المحدّد من قائمة المستجيبين لـ Form. |
remove | Form | يزيل هذا الإجراء المستخدم المحدّد من قائمة المستجيبين لـ Form. |
set | Form | تضبط هذه السمة ما إذا كان النموذج يقبل الردود حاليًا. |
set | Form | تضبط ما إذا كان النموذج يعرض رابطًا لتعديل الرد بعد إرساله. |
set | Form | تضبط هذه السمة ما إذا كان النموذج يجمع عناوين البريد الإلكتروني للمستجيبين. |
set | Form | تضبط هذه السمة رسالة تأكيد النموذج. |
set | Form | تضبط هذه السمة الرسالة التي سيتم عرضها إذا كان النموذج لا يقبل الردود. |
set | Form | تضبط هذه السمة وصف النموذج. |
set | Form | يضبط هذا الإعداد الوجهة التي يتم فيها حفظ ردود النموذج. |
set | Form | تضبط هذه السمة ما إذا كان النموذج اختبارًا. |
set | Form | تضبط هذه السمة ما إذا كان النموذج يسمح بردّ واحد فقط لكل مجيب. |
set | Form | تضبط هذه السمة ما إذا كان النموذج يتضمّن شريط تقدّم. |
set | Form | تضبط هذه السمة ما إذا كان النموذج منشورًا. |
set | Form | تحدّد ما إذا كان النموذج يعرض رابطًا للاطّلاع على ملخّص الردود بعد أن يرسل المجيب النموذج. |
set | Form | تحدّد ما إذا كان النموذج يعرض رابطًا لإرسال رد آخر بعد أن يكمل المجيب النموذج. |
set | Form | تحدّد هذه السمة ما إذا كان ترتيب الأسئلة في كل صفحة من النموذج عشوائيًا. |
set | Form | تضبط هذه السمة عنوان النموذج. |
shorten | String | تحويل عنوان URL طويل خاص بنموذج إلى عنوان URL قصير |
submit | Form | يرسل الدرجات لردود النماذج المحدّدة. |
supports | Boolean | تحدِّد ما إذا كان النموذج يتيح النشر. |
مستندات تفصيلية
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(); 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()
تضيف هذه الطريقة عنصر سؤال جديدًا يتيح للمستجيب اختيار مربّع اختيار واحد أو أكثر، بالإضافة إلى حقل "غير ذلك" اختياري.
// 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. إذا كان المستخدم مُدرَجًا في قائمة المشاهدين أو المجيبين، ستؤدي هذه الطريقة إلى إزالة المستخدم من القائمة.
// 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 editor to the form. // TODO(developer): replace the emailAddress. form.addEditor('editor@uni.edu');
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
email | String | عنوان البريد الإلكتروني للمستخدم الذي تريد إضافته |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addEditor(user)
تضيف هذه الطريقة المستخدم المحدّد إلى قائمة المحرّرين في Form. إذا كان المستخدم مُدرَجًا في قائمة المشاهدين أو المجيبين، ستؤدي هذه الطريقة إلى إزالة المستخدم من القائمة.
// Opens the Forms file by its URL. // TODO(developer): Replace the URL with your own. const oldForm = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets the editors from the old form. const users = oldForm.getEditors(); // Creates a new form. const newForm = FormApp.create('New form'); // Adds the editors to a new form. users.forEach(user => newForm.addEditor(user));
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
user | User | تمثيل للمستخدم الذي تريد إضافته |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addEditors(emailAddresses)
تضيف هذه الطريقة مصفوفة المستخدمين المحدّدة إلى قائمة المحرّرين في Form. إذا كان أي من المستخدمين
مدرجًا في قائمة المشاهدين، ستؤدي هذه الطريقة إلى إزالته من قائمة المشاهدين.
// 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 editors to the form. // TODO(developer): replace the emailAddress. form.addPublishedReaders(['editor1@uni.edu', 'editor2@uni.edu']);
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
email | String[] | مصفوفة من عناوين البريد الإلكتروني للمستخدمين الذين تريد إضافتهم |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
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()
يضيف عنصر سؤال جديدًا يتيح للمستجيب اختيار خيار واحد من قائمة أزرار اختيار أو حقل "غير ذلك" اختياري.
// 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
addPublishedReader(emailAddress)
تضيف هذه الطريقة المستخدم المحدّد إلى قائمة المستجيبين لـ Form. إذا كان المستخدم مُدرجًا في قائمة المحرّرين أو المشاهدين، لن يكون لهذا الإجراء أي تأثير.
// 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 responder to the form. // TODO(developer): replace the emailAddress. form.addPublishedReader('responder@uni.edu');
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
email | String | عنوان البريد الإلكتروني للمستخدم الذي تريد إضافته |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addPublishedReader(user)
تضيف هذه الطريقة المستخدم المحدّد إلى قائمة المستجيبين لـ Form. إذا كان المستخدم مُدرجًا في قائمة المحرّرين أو المشاهدين، لن يكون لهذا الإجراء أي تأثير.
// Opens the Forms file by its URL. // TODO(developer): Replace the URL with your own. const oldForm = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets the responders from the old form. const users = oldForm.getPublishedReaders(); // Creates a new form. const newForm = FormApp.create('New form'); // Adds the responders to a new form. users.forEach(user => newForm.addPublishedReader(user));
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
user | User | تمثيل للمستخدم الذي تريد إضافته |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addPublishedReaders(emailAddresses)
تضيف هذه الطريقة مصفوفة المستخدمين المحدّدة إلى قائمة المستجيبين لـ Form. إذا كان المستخدم
مدرجًا في قائمة المحرّرين أو المشاهدين، لن يكون لهذا الإجراء أي تأثير.
// 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 responders to the form. // TODO(developer): replace the emailAddress. form.addPublishedReaders(['responder1@uni.edu', 'responder2@uni.edu']);
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
email | String[] | مصفوفة من عناوين البريد الإلكتروني للمستخدمين الذين تريد إضافتهم |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
addRatingItem()
تضيف هذه الطريقة عنصر سؤال جديدًا يتيح للمجيب تقديم تقييم.
// 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 rating item. const item = form.addRatingItem();
الإرجاع
RatingItem: العنصر الذي تم إنشاؤه حديثًا
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
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()
يحذف هذا الإجراء جميع الردود المُرسَلة من مستودع الردود في النموذج. لا تؤدي هذه الطريقة إلى حذف نُسخ الردود المخزّنة في وجهة ردود خارجية (مثل جدول بيانات)، ولكنها تؤدي إلى محو عرض الملخّص للنموذج.
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
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); }
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
index | Integer | تمثّل هذه السمة فهرس العنصر بين جميع العناصر في النموذج. |
عمليات الطرح
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); }
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
item | Item | العنصر المطلوب حذفه |
عمليات الطرح
Error: إذا لم يكن العنصر متوفّرًا في النموذج
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
deleteResponse(responseId)
يحذف هذا الإجراء ردًا واحدًا من مستودع الردود في النموذج. لا تحذف هذه الطريقة نُسخ الردود المخزّنة في وجهة ردود خارجية (مثل جدول بيانات)، ولكنها تزيل الرد من عرض الملخّص للنموذج. يمكن استرداد رقم تعريف الردّ باستخدام FormResponse.getId().
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
response | String | رقم تعريف الردّ على النموذج المطلوب حذفه |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
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);
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
id | Integer | معرّف السلعة. |
الإرجاع
Item|null: العنصر الذي يحمل المعرّف المحدّد، أو 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);
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
item | Item | نوع العناصر المطلوب استردادها. |
الإرجاع
Item[]: هي مصفوفة تتضمّن جميع العناصر من هذا النوع.
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
getPublishedReaders()
تعرض هذه الطريقة قائمة المجيبين عن Form.
// 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 responders for the form. const users = form.getPublishedReaders(); users.forEach(user => console.log(user.getEmail()));
الإرجاع
User[]: مصفوفة من المستخدمين الذين لديهم إذن الردّ
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
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().
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
response | String | رقم تعريف الردّ على النموذج |
الإرجاع
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)
تعرض هذه الدالة مصفوفة تتضمّن جميع ردود النموذج بعد تاريخ ووقت محدّدَين.
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
timestamp | Date | أبكر تاريخ ووقت يجب عرض ردود النموذج فيهما. |
الإرجاع
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
hasRespondAgainLink()
تحدّد ما إذا كان النموذج يعرض رابطًا لإرسال رد آخر بعد أن يكمل المجيب النموذج.
// 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
isPublished()
تحدِّد هذه السمة ما إذا كان النموذج منشورًا.
لا تتوفّر هذه الميزة إلا للنماذج التي تتيح النشر. استخدِم supportsAdvancedResponderPermissions() للتحقّق مما إذا كان النموذج يتيح النشر.
// 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 whether the form is published or not and logs it to the console. console.log(form.isPublished());
الإرجاع
Boolean: true إذا تم نشر النموذج، false إذا لم يتم نشره
عمليات الطرح
Error: إذا تم استدعاؤها في نماذج غير متوافقة
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
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);
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
from | Integer | الفهرس الحالي للعنصر بين جميع العناصر في النموذج |
to | Integer | الفهرس الجديد للعنصر بين جميع العناصر في النموذج |
الإرجاع
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);
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
item | Item | العنصر المطلوب نقله |
to | Integer | الفهرس الجديد للعنصر بين جميع العناصر في النموذج |
الإرجاع
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();
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
removeEditor(emailAddress)
تزيل هذه الطريقة المستخدم المحدّد من قائمة المحرّرين في Form. لا تمنع هذه الطريقة المستخدمين من الوصول إلى Form إذا كانوا ينتمون إلى فئة من المستخدمين لديهم إذن عام بالوصول، مثلاً إذا تمت مشاركة Form مع النطاق الكامل للمستخدم، أو إذا كان Form في مساحة تخزين سحابي مشتركة يمكن للمستخدم الوصول إليها.
بالنسبة إلى ملفات Drive، يؤدي ذلك أيضًا إلى إزالة المستخدم من قائمة المشاهدين والمجيبين.
// Opens the Forms file by its URL. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Removes the editor from the form. // TODO(developer): replace the emailAddress. form.removeEditor('editor@uni.edu');
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
email | String | عنوان البريد الإلكتروني للمستخدم الذي تريد إزالته |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
removeEditor(user)
تزيل هذه الطريقة المستخدم المحدّد من قائمة المحرّرين في Form. لا تمنع هذه الطريقة المستخدمين من الوصول إلى Form إذا كانوا ينتمون إلى فئة من المستخدمين لديهم إذن عام بالوصول، مثلاً إذا تمت مشاركة Form مع النطاق الكامل للمستخدم، أو إذا كان Form في مساحة تخزين سحابي مشتركة يمكن للمستخدم الوصول إليها.
بالنسبة إلى ملفات Drive، يؤدي ذلك أيضًا إلى إزالة المستخدم من قائمة المشاهدين.
// Opens the Forms file by its URL. // TODO(developer): Replace the URL with your own. const form1 = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets the editors from the form. const users = form1.getEditors(); // Opens another form. // TODO(developer): Replace the URL with your own. const form2 = FormApp.openByUrl('https://docs.google.com/forms/d/efg123456/edit'); // Removes editors from the form. users.forEach(user => form2.removeEditor(user));
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
user | User | تمثيل للمستخدم المطلوب إزالته |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
removePublishedReader(emailAddress)
يزيل هذا الإجراء المستخدم المحدّد من قائمة المستجيبين لـ Form. لا تمنع هذه الطريقة المستخدمين من الوصول إلى Form إذا كانوا ينتمون إلى فئة من المستخدمين لديهم إذن عام بالوصول، مثلاً، إذا تمت مشاركة Form مع النطاق الكامل للمستخدم، أو إذا كان Form في مساحة تخزين سحابي مشتركة يمكن للمستخدم الوصول إليها.
بالنسبة إلى ملفات Drive، يؤدي ذلك أيضًا إلى إزالة المستخدم من قائمة المشاهدين والمحرّرين.
// Opens the Forms file by its URL. // TODO(developer): Replace the URL with your own. const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Removes the responders from the form. // TODO(developer): replace the emailAddress. form.removePublishedReader('responder1@uni.edu');
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
email | String | عنوان البريد الإلكتروني للمستخدم الذي تريد إزالته |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
removePublishedReader(user)
يزيل هذا الإجراء المستخدم المحدّد من قائمة المستجيبين لـ Form. لا تمنع هذه الطريقة المستخدمين من الوصول إلى Form إذا كانوا ينتمون إلى فئة من المستخدمين لديهم إذن عام بالوصول، مثلاً، إذا تمت مشاركة Form مع النطاق الكامل للمستخدم، أو إذا كان Form في مساحة تخزين سحابي مشتركة يمكن للمستخدم الوصول إليها.
بالنسبة إلى ملفات Drive، يؤدي ذلك أيضًا إلى إزالة المستخدم من قائمة المشاهدين والمحرّرين.
// Opens the Forms file by its URL. // TODO(developer): Replace the URL with your own. const form1 = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit'); // Gets the responders from the form. const users = form1.getPublishedReaders(); // Opens another form. // TODO(developer): Replace the URL with your own. const form2 = FormApp.openByUrl('https://docs.google.com/forms/d/efg123456/edit'); // Removes responders from the form. users.forEach(user => form2.removePublishedReader(user));
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
user | User | تمثيل للمستخدم المطلوب إزالته |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
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());
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
enabled | Boolean | true إذا كان النموذج سيقبل الردود؛ false إذا كان النموذج لن يقبل الردود. |
الإرجاع
عمليات الطرح
Error: إذا كانت مفعَّلة في نموذج غير منشور
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
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());
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
enabled | Boolean | true إذا كان النموذج سيعرض رابط "تعديل ردّك"، false إذا لم يكن كذلك. |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
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);
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
collect | Boolean | true إذا كان النموذج سيجمع عناوين البريد الإلكتروني، false إذا لم يكن كذلك. |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
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);
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
message | String | رسالة التأكيد الجديدة للنموذج |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
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);
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
message | String | الرسالة التي سيتم عرضها إذا كان النموذج لا يقبل الردود. |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setDescription(description)
تضبط هذه السمة وصف النموذج.
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
description | String | الوصف الجديد للنموذج. |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setDestination(type, id)
يضبط هذا الإعداد الوجهة التي يتم فيها حفظ ردود النموذج. يتم حفظ نسخة من الردود في مستودع الردود الخاص بالنموذج في جميع النماذج، بما في ذلك النماذج التي لم يتم ضبط وجهة لها بشكل صريح.
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
type | Destination | نوع وجهة الردّ على النموذج |
id | String | معرّف وجهة الردود على النموذج |
الإرجاع
عمليات الطرح
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());
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
enabled | Boolean | true إذا كان يجب تفعيل ميزات الاختبار في النموذج، false إذا لم يكن يجب ذلك. |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setLimitOneResponsePerUser(enabled)
تضبط هذه السمة ما إذا كان النموذج يسمح بردّ واحد فقط لكل مجيب. الإعداد التلقائي للنماذج الجديدة هو false. في حال ضبط القيمة على true، لن يتمكّن النص البرمجي من إرسال ردود النموذج على الإطلاق.
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
enabled | Boolean | true إذا كان النموذج يجب أن يسمح برد واحد فقط لكل مجيب، false إذا لم يكن كذلك |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
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());
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
enabled | Boolean | true إذا كان النموذج يعرض شريط تقدّم، false إذا لم يكن يعرضه |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setPublished(enabled)
تحدّد ما إذا كان النموذج منشورًا. الإعداد التلقائي للنماذج الجديدة هو true.
لا تتوفّر هذه الميزة إلا للنماذج التي تتيح النشر. استخدِم supportsAdvancedResponderPermissions() للتحقّق مما إذا كان النموذج يتيح النشر.
يجب نشر النموذج ليتمكّن المجيبون من الوصول إليه. تحلّ هذه الطريقة محلّ عمليات استدعاء setAcceptingResponses(enabled).
// 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', ); // Publishes the form before sharing it. form.setPublished(true); // Checks whether the form is published or not and logs it to the console. console.log(form.isPublished());
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
enabled | Boolean | true إذا كان يجب نشر النموذج، false إذا لم يكن كذلك. |
الإرجاع
عمليات الطرح
Error: إذا تم استدعاؤها في نماذج غير متوافقة
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setPublishingSummary(enabled)
تحدّد ما إذا كان النموذج يعرض رابطًا للاطّلاع على ملخّص الردود بعد أن يرسل المجيب النموذج. الإعداد التلقائي للنماذج الجديدة هو false.
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
enabled | Boolean | true إذا كان النموذج سيعرض الرابط "عرض الردود السابقة"؛ false إذا لم يكن. |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setShowLinkToRespondAgain(enabled)
تحدّد ما إذا كان النموذج يعرض رابطًا لإرسال رد آخر بعد أن يكمل المجيب النموذج. الإعداد التلقائي للنماذج الجديدة هو true.
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
enabled | Boolean | true إذا كان من المفترض أن يعرض النموذج الرابط "إرسال رد آخر"؛ false إذا لم يكن كذلك. |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setShuffleQuestions(shuffle)
تحدّد هذه السمة ما إذا كان ترتيب الأسئلة في كل صفحة من النموذج عشوائيًا.
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
shuffle | Boolean | true إذا كان يجب ترتيب الأسئلة بشكل عشوائي على كل صفحة من النموذج، false إذا لم يكن ذلك ضروريًا |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
setTitle(title)
تضبط هذه السمة عنوان النموذج.
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
title | String | تمثّل هذه السمة العنوان الجديد للنموذج. |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
shortenFormUrl(url)
تحويل عنوان URL طويل خاص بنموذج إلى عنوان URL قصير يطرح هذا الإجراء استثناءً إذا كان عنوان URL الطويل لا ينتمي إلى "نماذج Google".
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
url | String | تمثّل هذه السمة عنوان URL المطلوب اختصاره. |
الإرجاع
String: عنوان URL بالتنسيق http://goo.gl/forms/1234
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
submitGrades(responses)
يرسل الدرجات لردود النماذج المحدّدة.
إذا كان الرمز يتضمّن مشغّلاً onFormSubmit، سيؤدي استدعاء submitGrades()
إلى تشغيل الشرط onFormSubmit وحدوث حلقة لا نهائية. لمنع حدوث حلقة لا نهائية، أضِف رمزًا برمجيًا يتحقّق مما إذا كانت الدرجات متوفّرة قبل استدعاء submitGrades().
المَعلمات
| الاسم | النوع | الوصف |
|---|---|---|
responses | Form | مصفوفة تتضمّن جميع الردود على النموذج |
الإرجاع
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
supportsAdvancedResponderPermissions()
تحدِّد ما إذا كان النموذج يتيح النشر. تُستخدَم هذه الطريقة لتحديد ما إذا كانت الطريقتان setPublished(enabled) وisPublished() وأذونات المستجيب متوفّرة.
// 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 whether the form supports publishing or not and logs it to the // console. console.log(form.supportsAdvancedResponderPermissions());
الإرجاع
Boolean: true إذا كان النموذج يتيح النشر، false إذا كان لا يتيح ذلك.
التفويض
تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms