Hi,

Also, about the Phone Number and the Notes:

$entry->setContent( new Zend_Gdata_App_Extension_Content( 'New NOTE',
'text'));
$extension = new Zend_Gdata_App_Extension_Element('phoneNumber', null,
'http://schemas.google.com/g/2005');
$extension->setText('555-6789');
$attribures1 = array();
$attributes1['rel'] = array('namespaceUri'=>null,'name'=>'rel',
'value' => 'http://schemas.google.com/g/2005#home');
$extension->setExtensionAttributes($attributes1);
array_push( $extensionElements, $extension );
$entry->setExtensionElements( $extensionElements );
$entry->save();

The Relation for the phone number can be one of the following:
http://code.google.com/apis/gdata/elements.html#gdPhoneNumber

Cheers,
Julian

On Apr 6, 5:16 pm, "Julian (Google)" <[email protected]> wrote:
> Hi,
>
> Similar to my previous post (http://groups.google.com/group/google-
> contacts-api/browse_thread/thread/55ca554133da51ac), just by changing
> the feed to a Groups feed. You can delete a whole Group(Entry) using
> its Title like this:
>
> <?php
> $clientLibraryPath = '/var/www/contacts/Zend';
> $oldPath = set_include_path(get_include_path() . PATH_SEPARATOR .
> $clientLibraryPath);
>
> require_once 'Loader.php';
>
> Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
> Zend_Loader::loadClass('Zend_Gdata');
> Zend_Loader::loadClass('Zend_Gdata_Query');
>
> // Using Client Login
> $client = Zend_Gdata_ClientLogin::getHttpClient("[email protected]",
> "Password", "cp");
> $gdata = new Zend_Gdata($client);
> $query = new Zend_Gdata_Query('http://www.google.com/m8/feeds/groups/
> user%40domain.com/full');
> $feed = $gdata->getFeed($query,Zend_Gdata_App_Feed);
>
> foreach ($feed->getEntry() as $entry ) {
>  if ( $entry->getTitle()->getText() == "GROUP Title" )
>    $entry->delete();
>
> }
>
> ?>
>
> If you have the ID of the Group, you can get the entry directly and
> delete it without iterating over the whole list.
>
> Cheers,
> -Julian
>
> On Apr 6, 3:01 pm, darie nicolae <[email protected]> wrote:
>
> > Hey Julian, the code Andrew wrote above it was for removing a whole
> > group, the code you said to remove all contacts from a group actually
> > it didnt worked, it added a duplicate of the last contact instead and
> > nothing was deleted.
>
> > Do you know what could be the problem?
>
> > And also, how can i add phoneNumber and Notes to a contact when i add
> > it to a group ?( Talking about PHP )
>
> > Gracias!
>
> > On Apr 6, 3:58 pm, "Julian (Google)" <[email protected]> wrote:
>
> > > You're welcome Andrew.
>
> > > Because other people asked about .NET, here is an example in C# (using
> > > the latest library). This removes a user from group using a group ID:
>
> > > RequestSettings requestSettings = new RequestSettings("App-name",
> > > "[email protected]", "PASSWORD");
> > > requestSettings.AutoPaging = true;
> > > ContactsRequest contactsRequest = new ContactsRequest
> > > (requestSettings);
> > > Uri uri = new Uri("http://www.google.com/m8/feeds/contacts/user
> > > %40domain.com/full/1"); // User's ID
> > > Contact contact = contactsRequest.Retrieve<Contact>(uri);
>
> > > foreach (GroupMembership group in contact.GroupMembership){
> > >   // Group's ID
> > >   if ( group.HRef.Equals( "http://www.google.com/m8/feeds/groups/user
> > > %40domain.com/base/6" )) {
> > >     contact.GroupMembership.Remove( group );
> > >     contactsRequest.Update<Contact>(contact);
> > >      break;
> > >   }
>
> > > }
>
> > > On Apr 4, 4:43 am, andyjimmy <[email protected]> wrote:
>
> > > > Worked a charm Julian. Thank you very much!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to