简体   繁体   English

如何使用具有多个值的People API创建新联系人

[英]How to Create new Contact using People API with multiple values

I want to Create New Contact with multiple emails and phone numbers 我想创建包含多个电子邮件和电话号码的新联系人

i have try with one email and phone number it is working this is the code im using 我尝试使用一个电子邮件和电话号码,这是我正在使用的代码


$name = new Google_Service_PeopleService_Name();
$name->setGivenName('00nirman');
$name->setFamilyName('weerasinghe');
$person->setNames($name);
$email1 = new Google_Service_PeopleService_EmailAddress();
$email1->setValue('test@example.com');
$person->setEmailAddresses($email1);

$phone1 = new Google_Service_PeopleService_PhoneNumber();
$phone1->setValue('0777677305');
$phone1->setType('home');
$person->setPhoneNumbers($phone1);
$exe = $people_service->people->createContact($person)->execute;

Can Someone help me to modify the code to push multiple values i have go true lots of google docs but i cannot fine a way to do in php 可以有人帮我修改代码来推送多个值我已经实现了很多谷歌文档,但我不能很好的方式在PHP中做

Parogrock thank you for the answer Parogrock谢谢你的回答

$phone1 = new Google_Service_PeopleService_PhoneNumber();
$phone2 = new Google_Service_PeopleService_PhoneNumber();
$phone1->setValue('0777677305');
$phone2->setValue('0774112128');

$person->setPhoneNumbers([$phone1,$phone2]);

$exe = $people_service->people->createContact($person)->execute;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM