Thanks SO MUCH for your help on this, everyone - I've been having so
much trouble figuring out how to do this without any Zend Contacts
API, I can't tell you. I'm using the code that Kris provided above
but can't seem to get any further at all, meaning - I can't get
anything other than the one email extension to save. However I try, I
can't replicate this procedure for phoneNumber, postalAddress, a
second email address, phone numbers or anything .. someone PLEASE show
me the key to figuring this out. Different refs, uris, array types?
Grr ..
Here's the source ..
// this section works great - thanks, Kris!
$extension = new Zend_Gdata_App_Extension_Element('email', null,
'http://schemas.google.com/g/2005');
$attributes['address'] = array('name'=>'address', 'value' =>
$homeemail);
$attributes['rel'] = array('name'=>'rel', 'namespaceUri'=>null,
'value' => 'http://schemas.google.com/g/2005#home');
$attributes['primary'] = array('name'=>'primary', 'namespaceUri' =>
null, 'value' => 'true');
$extension->setExtensionAttributes($attributes);
// this is me trying to add a second email addy, as well .. however,
only one email ends up getting saved to gbase.
$extension1 = new Zend_Gdata_App_Extension_Element('email', null,
'http://schemas.google.com/g/2005');
$attributes1['address'] = array('name'=>'address', 'value' =>
$workemail);
$attributes1['rel'] = array('name'=>'rel', 'namespaceUri'=>null,
'value' => 'http://schemas.google.com/g/2005#work');
$attributes1['primary'] = array('name'=>'primary', 'namespaceUri' =>
null, 'value' => 'false');
$extension1->setExtensionAttributes($attributes1);
// this is me trying to add a postal address ..
$extension2 = new Zend_Gdata_App_Extension_Element('postalAddress',
null, 'http://schemas.google.com/g/2005');
$attributes2['address'] = array('name'=>'text', 'value' =>
$theiraddy);
$attributes2['rel'] = array('name'=>'rel', 'namespaceUri'=>null,
'value' => 'http://schemas.google.com/g/2005#home');
$attributes2['primary'] = array('name'=>'primary', 'namespaceUri' =>
null, 'value' => 'true');
$extension2->setExtensionAttributes($attributes2);
// here's the actual writing bit
$entry = $gdata->newEntry();
$entry->title = $gdata->newTitle($name);
$entry->setExtensionElements(array($extension));
$entryResult = $gdata->insertEntry($entry,$mystream);
Which leads me to another big question .. how do I add multiple
extensions?
// $entry->setExtensionElements(array($extension),array
($extension1),array($extension2));
Doesn't seem to work. Again, thanks to everyone who has participated
in this thread so far - this is the ONLY place on the web to find this
particular nugget of information at the moment. Until the Zend
contacts API is out, this thread will probably be THE resource for
people trying to figure it out on their own. Was for me. :).
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---