简体   繁体   中英

Google Contacts v3 API: groupMembershipInfo for a contact's individual email address?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM