0

How do I retrieve individual email addresses that are members of a Google Contact Group?

Using the API, I seem to be able to only see which contacts are members of a group - contacts that might have multiple email addresses. However, the Gmail UI lets me create a group with individual email addresses.

To repro: 1) Open https://mail.google.com/mail/u/0/#contacts 2) Create a new contact called John Smith with two email addresses: jsmith@gmail.com and jsmith@work.com 3) Create a new contact group call "my group". Add (only) jsmith@work.com to that group. 4) Now use the Google Contacts v3 API to fetch John Smith's record. It will look like this:

'gd$name': { 'gd$fullName': { '$t': 'John Smith' }, ... },
'gd$email': 
[ { address: 'jsmith@gmail.com',
   primary: 'true',
   rel: 'http://schemas.google.com/g/2005#other' },
 { address: 'jsmith@work.com',
   rel: 'http://schemas.google.com/g/2005#work' } ],
'gContact$groupMembershipInfo': 
[ { deleted: 'false',
   href: 'http://www.google.com/m8/feeds/groups/engtestuser%40mixmax.com/base/6' },
 { deleted: 'false',
   href: 'http://www.google.com/m8/feeds/groups/engtestuser%40mixmax.com/base/2a44002d89eb51e3' } ] }

How do I know that only jsmith@work.com was added to "my group" (with id 2a44002d89eb51e3)? Where is the association between email addresses and groups stored?

Brad Vogel
  • 436
  • 3
  • 16

1 Answers1

0

Entire contacts are added to groups, not just individual emails. You are finding the contact using one of their two email addresses, but the entire contact with both email addresses is added to the group. For this reason it's not possible to make that distinction.

Eric Koleda
  • 12,420
  • 1
  • 33
  • 51
  • Thanks Eric. Does this mean the gmail UI is using a private API for its contact groups (which can make that distinction)? – Brad Vogel May 20 '15 at 20:39
  • How can you tell the Gmail UI is making the distinction? – Eric Koleda May 26 '15 at 13:37
  • To repro: 1) Open https://mail.google.com/mail/u/0/#contacts 2) Create a new contact called John Smith with two email addresses: jsmith@gmail.com and jsmith@work.com 3) Create a new contact group call "my group" and add (only) jsmith@work.com to that group 4) Now compose a new message in Gmail and type "my group". You'll see the group autocomplete to only jsmith@work.com. However, there is no way in the API to see that only jsmith@work.com is in that group; it only returns both his addresses. – Brad Vogel May 26 '15 at 17:43