進階使用者服務可讓您使用 Apps Script 中的 People API。這個 API 允許指令碼 建立、讀取和更新登入使用者的聯絡人資料,以及讀取個人資料 Google 使用者資料
參考資料
如要進一步瞭解這項服務,請參閱 People API 的參考說明文件。 如同 Apps Script 的所有進階服務,進階使用者服務一樣會使用 物件、方法和參數詳情請參閱如何判定方法簽章。
如要回報問題及尋求其他支援,請參閱 使用者 v1 支援指南。
程式碼範例
下方的程式碼範例使用第 1 版的 API。
取得使用者連結
如要取得使用者的聯絡人清單, 請使用以下程式碼:
取得使用者的聯絡人
如要取得使用者的個人資料,請提出要求
https://www.googleapis.com/auth/userinfo.profile
範圍,請參閱
新增明確範圍的操作說明
加入 appsscript.json
資訊清單檔案新增範圍後
下列程式碼:
取得 Google 帳戶的使用者資訊
如要取得任何 Google 帳戶的個人資訊, 請使用以下程式碼: