Hello!  I am using the following code to loop through mysql database and 
add contacts to my google contacts.  I am totally stumped as to how to 
assign a group membership for each contact.  Can someone give me a hint or 
better yet the answer to the code I need to add to a group called "EH"? 
 Below is the code that works to add contacts...

while($row = mysql_fetch_array($result))
{
  // 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');
  $doc->appendChild($entry);
  
  // add name element
  $name = $doc->createElement('gd:name');
  $entry->appendChild($name);
  $fullName = $doc->createElement('gd:fullName', $row['FirstName']." 
".$row['LastName']);
  $name->appendChild($fullName);
  
  // add email element
  $email = $doc->createElement('gd:email');
  $email->setAttribute('address' ,$row['EmailAddress']);
  $email->setAttribute('rel' ,'http://schemas.google.com/g/2005#work');
  $entry->appendChild($email);
  
  // add org name element
  $org = $doc->createElement('gd:organization');
  $org->setAttribute('rel' ,'http://schemas.google.com/g/2005#work');
  $entry->appendChild($org);
  $orgName = $doc->createElement('gd:orgName', $row['Company']);
  $org->appendChild($orgName);
  $orgTitle = $doc->createElement('gd:orgTitle', $row['JobTitle']);
  $org->appendChild($orgTitle);

-- 
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" 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://code.google.com/apis/contacts/community/forum.html

Reply via email to