Hi Julian,

Thanks so much for your help, I've got everything working!

For the record, it might be good for Google to take a look into this:

http://www.google.com/support/forum/p/Calendar/thread?fid=4da91b6497363b2f00046f63d26219ac&hl=en

Since it's pretty popular.

Thanks again!

Regards,

Kees.

On Mon, Jul 20, 2009 at 3:38 PM, Julian (Google) <[email protected]> wrote:

>
> Hi Kees,
>
> Sorry, the example before, is to delete a contact.
>
> You need to edit the List<GroupMembershipInfo> and remove the group,
> then update the Contact Entry. For example this removes the first
> group:
>
> URL entryUrl = new URL( "http://www.google.com/m8/feeds/contacts/user
> %40domain.com/full/7fbb8e628be1182a" );
> ContactEntry contactEntry = contactsService.getEntry
> ( entryUrl,ContactEntry.class);
> contactEntry.getGroupMembershipInfos().remove(0);
> contactEntry.update();
>
> --Julian.
>
> On Jul 20, 2:28 pm, "Julian (Google)" <[email protected]> wrote:
> > Hi Kees,
> >
> > It is really similar to the one before, get an Entry and call the
> > delete() function:
> >
> > URL entryUrl = new URL( "http://www.google.com/m8/feeds/contacts/user
> > %40domain.com/full/7fbb8e628be1182a" );
> > ContactEntry contactEntry = contactsService.getEntry
> > ( entryUrl,ContactEntry.class);
> > contactEntry.delete();
> >
> > --Julian
> >
> > On Jul 20, 2:21 pm, Kees van Bemmel <[email protected]> wrote:
> >
> > > Hi Julian,
> >
> > > Thanks for the help! Would you happen to have a working piece of code
> > > lying around which deletes a contact from a group?
> >
> > > Regards,
> >
> > > Kees.
> >
> > > Op 20 jul 2009 om 14:45 heeft "Julian (Google)" <[email protected]> het
>
> > > volgende geschreven:\
> >
> > > > Hi,
> >
> > > > I think the problem you are getting is because you need to use/get
> the
> > > > FULL protection for the Contact Entry, here is a small sample that
> > > > adds a user to an existing group:
> >
> > > >    URL entryUrl = new URL( "http://www.google.com/m8/feeds/contacts/
> > > > user%40domain.com/full/7fbb8e628be1182a" );
> > > >    ContactEntry contactEntry = contactsService.getEntry
> > > > ( entryUrl,ContactEntry.class);
> >
> > > >    GroupMembershipInfo groupMembershipInfo = new GroupMembershipInfo
> > > > ();
> > > >    groupMembershipInfo.setHref("
> http://www.google.com/m8/feeds/groups/
> > > > user%40domain.com/base/5ae379bc0bdda49a");
> > > >    contactEntry.addGroupMembershipInfo(groupMembershipInfo);
> > > >    contactEntry.update();
> >
> > > > Cheers,
> > > > Julian.
> >
> > > > On Jul 18, 9:25 pm, KvB <[email protected]> wrote:
> > > >> Hi all,
> >
> > > >> I'm trying to make my way through the google contacts api in java
> and
> > > >> I want to be able to add or delete contacts from contact groups. So
> > > >> far I haven't been succesful and I now have the following error.
> >
> > > >> When I run this code:
> >
> > > >> private void archiveContact(ContactEntry contact) throws Exception {
> > > >>                 if (ARCHIVE_GROUP_ID == null) {
> > > >>                         getArchiveGroupId();
> > > >>                 }
> >
> > > >>                 GroupMembershipInfo gmsi = new
> GroupMembershipInfo();
> > > >>                 gmsi.setHref(ARCHIVE_GROUP_ID);
> > > >>                 contact.addGroupMembershipInfo(gmsi);
> >
> > > >>                 URL editUrl = new URL(contact.getEditLink().getHref
> > > >> ());
> > > >>                 myService.update(editUrl, contact);
> >
> > > >>         }
> >
> > > >> I get this error:
> > > >> com.google.gdata.util.InvalidEntryException: Bad Request
> > > >> Group membership information not supported.
> >
> > > >> Does anyone have a working example of java usage of the api to add/
> > > >> remove existing contacts to/from existing contact groups? Or can
> > > >> anyone help me solve the error above?
> >
> > > >> Regards and thanks for any help in advance!
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to