با مجموعهها، منظم بمانید
ذخیره و دستهبندی محتوا براساس اولویتهای شما.
سرویس پیشرفته People به شما امکان می دهد از People API در Apps Script استفاده کنید. این API به اسکریپتها اجازه میدهد تا دادههای تماس را برای کاربر وارد شده ایجاد، خواندن و بهروزرسانی کنند و دادههای نمایه را برای کاربران Google بخوانند.
مرجع
برای اطلاعات دقیق در مورد این سرویس، به مستندات مرجع برای People API مراجعه کنید. مانند همه سرویسهای پیشرفته در Apps Script، سرویس پیشرفته افراد از همان اشیا، روشها و پارامترهای API عمومی استفاده میکند. برای اطلاعات بیشتر، نحوه تعیین امضای روش را ببینید.
/**
* Gets a list of people in the user's contacts.
* @see https://developers.google.com/people/api/rest/v1/people.connections/list
*/
function getConnections() {
try {
// Get the list of connections/contacts of user's profile
const people = People.People.Connections.list('people/me', {
personFields: 'names,emailAddresses'
});
// Print the connections/contacts
console.log('Connections: %s', JSON.stringify(people, null, 2));
} catch (err) {
// TODO (developers) - Handle exception here
console.log('Failed to get the connection with an error %s', err.message);
}
}
شخص را برای کاربر دریافت کنید
برای دریافت نمایه کاربر ، باید با دنبال کردن دستورالعملها، محدوده https://www.googleapis.com/auth/userinfo.profileرا برای افزودن دامنههای واضح به فایل مانیفست appsscript.json خود درخواست کنید. پس از اضافه شدن دامنه، می توانید از کد زیر استفاده کنید:
/**
* Gets the own user's profile.
* @see https://developers.google.com/people/api/rest/v1/people/getBatchGet
*/
function getSelf() {
try {
// Get own user's profile using People.getBatchGet() method
const people = People.People.getBatchGet({
resourceNames: ['people/me'],
personFields: 'names,emailAddresses'
// Use other query parameter here if needed
});
console.log('Myself: %s', JSON.stringify(people, null, 2));
} catch (err) {
// TODO (developer) -Handle exception
console.log('Failed to get own profile with an error %s', err.message);
}
}
/**
* Gets the person information for any Google Account.
* @param {string} accountId The account ID.
* @see https://developers.google.com/people/api/rest/v1/people/get
*/
function getAccount(accountId) {
try {
// Get the Account details using account ID.
const people = People.People.get('people/' + accountId, {
personFields: 'names,emailAddresses'
});
// Print the profile details of Account.
console.log('Public Profile: %s', JSON.stringify(people, null, 2));
} catch (err) {
// TODO (developer) - Handle exception
console.log('Failed to get account with an error %s', err.message);
}
}
تاریخ آخرین بهروزرسانی 2025-01-05 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-01-05 بهوقت ساعت هماهنگ جهانی."],[[["The advanced People service in Apps Script utilizes the People API to manage contact data for the logged-in user and access Google user profiles."],["This advanced service needs to be enabled before use and mirrors the functionality of the public People API."],["Scripts can create, read, and update contact details for the current user, as well as retrieve profile information for other Google users."],["Sample code snippets are provided to demonstrate functionalities like fetching user connections, retrieving the user's own profile, and getting information for any Google Account by ID."]]],[]]