使用Zend_GData和Google Contacts API将联系人添加到组中

|| 我有一个使用zend_gdata的应用程序,并使用下面的代码创建联系人。
$doc  = new DOMDocument();
$doc->formatOutput = true;
$entry = $doc->createElement(\'atom:entry\');
$entry->setAttributeNS(\'http://www.w3.org/2000/xmlns/\' ,\'xmlns:atom\', \'http://www.w3.org/2005/Atom\');
$entry->setAttributeNS(\'http://www.w3.org/2000/xmlns/\' , \'xmlns:gd\', \'http://schemas.google.com/g/2005\');
$doc->appendChild($entry);

// add name element
$name = $doc->createElement(\'gd:name\');
$entry->appendChild($name);

$fullName = $doc->createElement(\'gd:fullName\', htmlentities($data->firstname . \' \' . $data->lastname));
$name->appendChild($fullName);

// insert entry
$entryResult = $gdata->insertEntry($doc->saveXML(), \'http://www.google.com/m8/feeds/contacts/default/full\');
是否有可能将功能组添加到刚创建的联系人中?     
已邀请:
我有一个大班,不能全部粘贴,您需要以某种方式将其放在一起 步骤1) 获取所有群组(http://raiyaraj.wordpress.com/2008/09/17/gmail-gdata-contacts-group-via-proxy/)并找到您的群组ID或创建它(您可以使用zend进行操作)框架)(如果不存在) 第2步) 生成xml
// create new entry
        $doc  = new DOMDocument();
        $doc->formatOutput = true;
        $entry = $doc->createElement(\'atom:entry\');
        $entry->setAttributeNS(\'http://www.w3.org/2000/xmlns/\' , \'xmlns:atom\', \'http://www.w3.org/2005/Atom\');
        $entry->setAttributeNS(\'http://www.w3.org/2000/xmlns/\' , \'xmlns:gd\', \'http://schemas.google.com/g/2005\');
        $entry->setAttributeNS(\'http://www.w3.org/2000/xmlns/\' , \'xmlns:gContact\', \'http://schemas.google.com/contact/2008\');
        $doc->appendChild($entry);

...add various stuff....
    $name = $doc->createElement(\'gd:name\');
            $entry->appendChild($name);
            $fullName = $doc->createElement(\'gd:fullName\', $this->name);
            $name->appendChild($fullName);
.....

        $group = $doc->createElement(\'gContact:groupMembershipInfo\');
        $group->setAttribute(\'deleted\' ,\'false\');
        $group->setAttribute(\'href\' ,\'http://www.google.com/m8/feeds/groups/\' .urlencode($this->email) . \'/base/\'.$this->group_id);
        $entry->appendChild($group);
步骤3) 连接到gmail并执行查询
$service = $this->service;
// perform login and set protocol version to 3.0
$client = $service;
$gdata = new Zend_Gdata($client);
$gdata->setMajorProtocolVersion(3);
$entryResult = $gdata->insertEntry($this->getXML(), \'https://www.google.com/m8/feeds/contacts/default/full\');

return $entryResult->getLink(\'edit\');
请注意,您返回了编辑链接,以便保存后可以更新联系人或检查修改     
对的,这是可能的。同样,请参考以下文档。 http://code.google.com/apis/contacts/docs/3.0/reference.html#groupMembershipInfo     

要回复问题请先登录注册