Class CustomField
مستندات تفصيلية
getLabel()
تحصل على تصنيف هذا الحقل. قد يكون هذا الحقل أو ExtendedField أو String.
// Logs the label for all the address fields associated with contact
// 'John Doe'. This method can be similarly called for any field that has
// a label.
const contacts = ContactsApp.getContactsByName('John Doe');
const addressFields = contacts[0].getAddresses();
for (let i = 0; i < addressFields.length; i++) {
Logger.log(addressFields[i].getLabel());
}
الإرجاع
Object
: تصنيف هذا الحقل
التفويض
تتطلّب النصوص البرمجية التي تستخدِم هذه الطريقة الحصول على إذن واحد أو أكثر من النطاقات التالية:
-
https://www.google.com/m8/feeds
setLabel(label)
لضبط تصنيف هذا الحقل.
// Sets the label to 'Apartment' for the first address field associated
// with contact 'John Doe'. This method can be similarly called for any
// field that has a label.
const contacts = ContactsApp.getContactsByName('John Doe');
const addressFields = contacts[0].getAddresses();
addressFields[0].setLabel('Apartment');
المعلمات
الاسم | النوع | الوصف |
label | String | التصنيف الجديد لهذا الحقل |
الإرجاع
CustomField
: هذا الحقل مفيد لإنشاء سلاسل.
التفويض
تتطلّب النصوص البرمجية التي تستخدِم هذه الطريقة الحصول على إذن واحد أو أكثر من النطاقات التالية:
-
https://www.google.com/m8/feeds
الطرق المتوقّفة
deleteCustomField()
تمّ إيقاف هذا العمود نهائيًا. تم إيقاف هذه الدالة نهائيًا ويجب عدم استخدامها في النصوص البرمجية الجديدة.
يؤدي إلى حذف هذا الحقل.
const contacts = ContactsApp.getContactsByName('John Doe');
const fields = contacts[0].getCustomFields();
for (let i = 0; i < fields.length; i++) {
if (fields[i].getLabel() === 'foo') {
fields[i].deleteCustomField();
}
}
التفويض
تتطلّب النصوص البرمجية التي تستخدِم هذه الطريقة الحصول على إذن واحد أو أكثر من النطاقات التالية:
-
https://www.google.com/m8/feeds
getValue()
تمّ إيقاف هذا العمود نهائيًا. تم إيقاف هذه الدالة نهائيًا ويجب عدم استخدامها في النصوص البرمجية الجديدة.
تحصل على قيمة الحقل.
// Logs the value of all the custom fields for contact 'John Doe'
const contacts = ContactsApp.getContactsByName('John Doe');
const fields = contacts[0].getCustomFields();
for (const i in fields) {
Logger.log(fields[i].getValue());
}
الإرجاع
Object
: القيمة المخزّنة في الحقل
التفويض
تتطلّب النصوص البرمجية التي تستخدِم هذه الطريقة الحصول على إذن واحد أو أكثر من النطاقات التالية:
-
https://www.google.com/m8/feeds
setLabel(field)
تمّ إيقاف هذا العمود نهائيًا. تم إيقاف هذه الدالة نهائيًا ويجب عدم استخدامها في النصوص البرمجية الجديدة.
لضبط تصنيف هذا الحقل.
// Sets the first custom field associated with contact 'John Doe' to use 'Mail
// application' as a label, with 'Gmail' as the value.
const contacts = ContactsApp.getContactsByName('John Doe');
const field = contacts[0].getCustomFields()[0];
field.setLabel('Mail application');
field.setValue('Gmail');
المعلمات
الإرجاع
CustomField
: هذا الحقل مفيد لإنشاء سلاسل.
التفويض
تتطلّب النصوص البرمجية التي تستخدِم هذه الطريقة الحصول على إذن واحد أو أكثر من النطاقات التالية:
-
https://www.google.com/m8/feeds
setValue(value)
تمّ إيقاف هذا العمود نهائيًا. تم إيقاف هذه الدالة نهائيًا ويجب عدم استخدامها في النصوص البرمجية الجديدة.
لضبط قيمة هذا الحقل
// Sets the first custom field associated with contact 'John Doe' to use 'Mail
// application' as a label, with 'Gmail' as the value.
const contacts = ContactsApp.getContactsByName('John Doe');
const field = contacts[0].getCustomFields()[0];
field.setLabel('Mail application');
field.setValue('Gmail');
المعلمات
الاسم | النوع | الوصف |
value | Object | القيمة الجديدة |
الإرجاع
CustomField
: هذا الحقل مفيد لإنشاء سلاسل.
التفويض
تتطلّب النصوص البرمجية التي تستخدِم هذه الطريقة الحصول على إذن واحد أو أكثر من النطاقات التالية:
-
https://www.google.com/m8/feeds
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2024-12-22 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2024-12-22 (حسب التوقيت العالمي المتفَّق عليه)"],[[["`CustomField` is deprecated and the People API advanced service should be used instead."],["It represents a custom field within a Contact and previously allowed for getting, setting, and deleting custom field data."],["`getLabel()` and `setLabel(label)` methods remain available for retrieving and setting the label of a custom field."],["Several methods, including `deleteCustomField()`, `getValue()`, `setLabel(field)`, and `setValue(value)`, are deprecated and should no longer be used."]]],[]]