/** * Gets a list of people in the user's contacts. * @see https://developers.google.com/people/api/rest/v1/people.connections/list */functiongetConnections(){try{// Get the list of connections/contacts of user's profileconstpeople=People.People.Connections.list('people/me',{personFields:'names,emailAddresses'
});// Print the connections/contactsconsole.log('Connections:%s',JSON.stringify(people,null,2));}catch(err){// TODO (developers) - Handle exception hereconsole.log('Failedtogettheconnectionwithanerror%s',err.message);}}
/** * Gets the own user's profile. * @see https://developers.google.com/people/api/rest/v1/people/getBatchGet */functiongetSelf(){try{// Get own user's profile using People.getBatchGet() methodconstpeople=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 exceptionconsole.log('Failedtogetownprofilewithanerror%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 */functiongetAccount(accountId){try{// Get the Account details using account ID.constpeople=People.People.get('people/'+accountId,{personFields:'names,emailAddresses'
});// Print the profile details of Account.console.log('PublicProfile:%s',JSON.stringify(people,null,2));}catch(err){// TODO (developer) - Handle exceptionconsole.log('Failedtogetaccountwithanerror%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"]],["上次更新時間:2024-09-12 (世界標準時間)。"],[[["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."]]],[]]