進階使用者服務
進階 People 服務可讓您在 Apps Script 中使用 People API。這個 API 可讓指令碼建立、讀取及更新登入使用者的聯絡人資料,以及讀取 Google 使用者的個人資料。
參考資料
如要進一步瞭解這項服務,請參閱 People API 的參考說明文件。與 Apps Script 中的所有進階服務一樣,進階 People 服務會使用與公開 API 相同的物件、方法和參數。詳情請參閱「如何決定方法簽章」。
如要回報問題並尋求其他支援,請參閱 People v1 支援指南。
程式碼範例
以下程式碼範例使用 API 的 第 1 版。
取得使用者的連結
如要取得使用者聯絡人中的人員清單,請使用下列程式碼:
取得使用者的聯絡人
如要取得使用者的個人資料,您必須按照操作說明在 appsscript.json
資訊清單檔案中新增明確的範圍,以便要求 https://www.googleapis.com/auth/userinfo.profile
範圍。新增範圍後,您可以使用下列程式碼:
取得 Google 帳戶的使用者資訊
如要取得任何 Google 帳戶的使用者資訊,請使用以下程式碼:
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-12-21 (世界標準時間)。
[null,null,["上次更新時間:2024-12-21 (世界標準時間)。"],[[["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."]]],[]]