Расширенная служба People позволяет использовать API People в Apps Script. Этот API позволяет сценариям создавать, читать и обновлять контактные данные для вошедшего в систему пользователя, а также читать данные профиля для пользователей Google.
Ссылка
Подробную информацию об этом сервисе см. в справочной документации People API. Как и все расширенные службы в Apps Script, расширенная служба People использует те же объекты, методы и параметры, что и общедоступный 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); } }
/** * 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); } }
[[["Прост для понимания","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 UTC."],[[["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."]]],[]]