Hi,
You can remove the appropriate Extension Element for the Entry, for
example the following code iterates over all Entries and removes them
from one Group:
$client = Zend_Gdata_ClientLogin::getHttpClient("[email protected]",
"PASWORD", "cp");
$gdata = new Zend_Gdata($client);
$query = new Zend_Gdata_Query('http://www.google.com/m8/feeds/contacts/
user%40domain.com/full');
$query->setMaxResults(1000);
$feed = $gdata->getFeed($query,Zend_Gdata_App_Feed);
// Group ID to Remove:
$groupId = 'http://www.google.com/m8/feeds/groups/user%40domain.com/
base/7d60cf6309868fc6';
foreach ($feed->getEntry() as $entry ) {
$newExtensionElements = array();
foreach ( $entry->getExtensionElements() as $extensionElement ) {
$domElement = $extensionElement->getDom();
if ( !($domElement->tagName == 'groupMembershipInfo' and
$domElement->getAttribute( 'href' ) == $groupId )) {
array_push($newExtensionElements, $extensionElement );
}
}
#print_r( $newExtensionElements );
$entry->setExtensionElements( $newExtensionElements );
$entry->save();
}
You can find more information about Gdata_App_Base and
Gdata_App_Extension_Element in the following links:
http://framework.zend.com/apidoc/core/Zend_Gdata/App/Zend_Gdata_App_Base.html
http://framework.zend.com/apidoc/core/Zend_Gdata/App/Zend_Gdata_App_Extension_Element.html
Cheers,
Julian.
On Mar 28, 11:57 pm, darie nicolae <[email protected]> wrote:
> Hello,
>
> My question is how do i delete a contact from a group, through PHP?
>
> Thanks.
On Mar 28, 11:57 pm, darie nicolae <[email protected]> wrote:
> Hello,
>
> My question is how do i delete a contact from a group, through PHP?
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Contacts API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---