Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Gelişmiş Kişiler hizmeti, Apps Komut Dosyası'nda People API'yi kullanmanıza olanak tanır. Bu API, komut dosyalarına izin verir
giriş yapmış kullanıcının ve profil okumanın kişi verilerini oluşturmak, okumak ve güncellemek için
Google kullanıcıları için veriler.
Referans
Bu hizmetle ilgili ayrıntılı bilgi için bkz.
People API için referans belgeleri.
Apps Komut Dosyası'ndaki tüm gelişmiş hizmetler gibi gelişmiş Kişiler hizmeti de
herkese açık API ile aynı nesneler, yöntemler ve parametreler olmalıdır. Daha fazla bilgi için Metod imzaları nasıl belirlenir? başlıklı makaleyi inceleyin.
/** * 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);}}
Kullanıcının kişiliğini edinme
Kullanıcının profilini almak için şunları istemeniz gerekir:
https://www.googleapis.com/auth/userinfo.profile kapsamını
açık kapsam ekleme talimatlarıappsscript.json manifest dosyanıza ekleyin. Kapsam eklendikten sonra
şu kodu kullanın:
/** * 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);}}
İlgili kişinin bir Google Hesabı olmasını sağlayın
/** * 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);}}