Edd
Edd

Reputation: 975

Zend GData Contacts, add existing contact to existing group

I am trying to add an existing contact to an existing group through the zend framework gdata library.

My code is as follows:

$extensionElements = $entry->getExtensionElements();
$extension =  new Zend_Gdata_App_Extension_Element('groupMembershipInfo', null, 'http://schemas.google.com/contact/2008');
$attributes1 = array();
$attributes1['deleted'] = array('namespaceUri'=>null,'name'=>'deleted', 'value' => 'false');
$attributes1['href'] = array('namespaceUri'=>null,'name'=>'href', 'value' => $group_id);
$extension->setExtensionAttributes($attributes1);
array_push( $extensionElements, $extension );
$entry->setExtensionElements( $extensionElements );
$entry->save(null, null, $extra_header);

This method works for updating emails, websites, addresses and phone numbers of the contact, it only gives me this error with groups:

Error: exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 400 Group membership information not supported.'

Please if someone have come across this problem, I would appreciate some help.

Upvotes: 0

Views: 545

Answers (1)

MrGoodbyte
MrGoodbyte

Reputation: 69

I had exactly the same problem and it turned out that I was passing through the id as my edit link instead of the correct edit link. Once I had changed the edit link my updates ran perfectly.

Thanks to Mark who answered this question which pointed me in the right direction

Upvotes: 1

Related Questions