Not off hand. Regardless, you shouldn't rely on that because the v2 doesn't return that error. If you want to not allow duplicate emails, you need to check before creating/updating. See my previous email below.
On Mon, Feb 9, 2009 at 1:50 PM, ravi181229 <[email protected]> wrote: > > Hi Jesse, > > Do you have any idea, how do I get the Status Code from the > 'Response' ? > I just want to get the 'Status Code' and display description according > to that from my custom array. > > Thanks, > Ravi > > On Feb 10, 2:33 am, Jesse Mandel <[email protected]> wrote: > > You are right, I tried it and it failed but that is weird because in > > the Contacts > > API 2.0 Migration > > Guide<http://code.google.com/apis/contacts/docs/2.0/migration_guide.html > > > > it > > states: > > > > > More than one contact can now have the same email address, so Google no > > > longer returns a 409 Conflict status code if you try to create a new > > > contact with the same email address as another contact. Thus, if your > client > > > relies on this behavior, you may need to change your client to check > for > > > existing contacts with the given address before creating a new one. > > > > Does that mean Google is not yet running v2.0? They use the new 2.0 > > groups.... > > > > -Jesse > > > > On Mon, Feb 9, 2009 at 1:27 PM, ravi181229 <[email protected]> wrote: > > > > > Hi Jesse, > > > > > No, it's not allowed. > > > You can just go to your Gmail Contacts and try adding a contact with > > > existing email address. > > > It will display a message as I mentioned before and when we do with > > > Programming it throws 409 'Conflict' > > > > > Thanks, > > > Ravi > > > > > On Feb 10, 2:03 am, Jesse Mandel <[email protected]> wrote: > > > > I thought duplicate emails were allowed now? > > > > -Jesse > > > > > > On Mon, Feb 9, 2009 at 12:59 PM, ravi181229 <[email protected]> > wrote: > > > > > > > Hi Faisal, > > > > > > > Version Conflict exception occurs when you are trying to add/update > a > > > > > contact with the email address which Gmail already has (Cannot have > > > > > more than one contact with same email address). > > > > > > > You can either first check if this email address already exists or > > > > > just throw your custom exception. > > > > > > > I am trying to fetch the Status Code for each exception/ success > but > > > > > not able to get how to do. > > > > > If we get Status Code, we can display the message according to > that. > > > > > > > Regards, > > > > > Ravi > > > > > > > [email protected] wrote: > > > > > > Hi i am getting this exception.... > > > > > > > > Can not update the contact: > > > > > > com.google.gdata.util.VersionConflictException: Conflict > > > > > > <?xml version='1.0' encoding='UTF-8'?><entry xmlns=' > > >http://www.w3.org/ > > > > > > 2005/Atom' xmlns:gContact=' > http://schemas.google.com/contact/2008' > > > > > > xmlns:batch=' > http://schemas.google.com/gdata/batch'xmlns:gd='http:// > > > > > > schemas.google.com/g/2005'><id> > > >http://www.google.com/m8/feeds/contacts/ > > > > > > matthias.hirschfeld%40googlemail.com/base/1f68ced8851eb52</ > > > > > > id><updated>2009-01-29T13:34:51.756Z</updated><category > > > scheme='http:// > > > > > > schemas.google.com/g/2005#kind' term='http://schemas.google.com/ > > > > > > contact/2008#contact'/><title type='text'>Buschner, Michael</ > > > > > > title><link rel=' > http://schemas.google.com/contacts/2008/rel#edit- > > > > > > photo' type='image/*' href=' > http://www.google.com/m8/feeds/photos/ > > > > > > media/matthias.hirschfeld%40googlemail.com/ > > > > > > 1f68ced8851eb52/1B2M2Y8AsgTpgAmY7PhCfg'/><link rel='self' > > > > > > type='application/atom+xml' href=' > http://www.google.com/m8/feeds/ > > > > > > contacts/matthias.hirschfeld% > 40googlemail.com/full/1f68ced8851eb52'/ > > > > > > ><link rel='edit' type='application/atom+xml' href='http:// > > > > > > > > www.google.com/m8/feeds/contacts/matthias.hirschfeld%40googlemail.com. > > > .. > > > > > ><gd:email > > > > > > rel='http://schemas.google.com/g/2005#other' > > > > > > address='[email protected]' primary='true'/></entry> > > > > > > 2009-02-05 20:05:22,692 > > > > > > > > The code responsible is the following: > > > > > > > > this.contacts = GoogleContactUtils.findContacts(conService,this); > > > > > > > > public static List<ContactEntry> findContacts(ContactsService > > > > > > service,SessionInfo sessionInfo) > > > > > > throws RepositoryException{ > > > > > > > > try{ > > > > > > String userId=sessionInfo.getUserID(); > > > > > > > > URL feedUrl = new URL(" > > > > >http://www.google.com/m8/feeds/ > > > > > > contacts/"+userId+"/full"); > > > > > > ContactQuery query = new > ContactQuery(feedUrl); > > > > > > query.setStartIndex(1); > > > > > > query.setMaxResults(10000); > > > > > > > > ContactFeed contactResult = > > > service.getFeed(query, > > > > > > ContactFeed.class); > > > > > > List<ContactEntry> contacts=new > > > > > ArrayList<ContactEntry>(); > > > > > > > contacts.addAll(contactResult.getEntries()); > > > > > > return contacts; > > > > > > }catch (Exception e){ > > > > > > throw new RepositoryException("An exception > has > > > > > occured while > > > > > > finding contacts from Google" + e.toString()); > > > > > > } > > > > > > > > } > > > > > > GoogleContactUtils.setContactUniqueName(this.contacts); > > > > > > > > public static void setContactUniqueName(List<ContactEntry> > contacts) > > > > > > throws RepositoryException{ > > > > > > for(ContactEntry oldContact:contacts){ > > > > > > ContactEntry contact = null; > > > > > > try{ > > > > > > contact=oldContact.getSelf(); > > > > > > }catch(Exception e){ > > > > > > throw new RepositoryException("Can > not > > > > > update the contact: > > > > > > "+e.toString()); > > > > > > } > > > > > > List<ExtendedProperty> properties = > > > > > contact.getExtendedProperties > > > > > > (); > > > > > > if(properties.size()==0){ > > > > > > ExtendedProperty property = new > > > > > ExtendedProperty(); > > > > > > property.setName("syncId"); > > > > > > > property.setValue(contact.getId().substring(7).replaceAll("/", > > > > > > "^")); > > > > > > > contact.addExtendedProperty(property); > > > > > > try{ > > > > > > contact.update(); > > > > > > }catch(Exception e){ > > > > > > throw new > > > RepositoryException("Can > > > > > not update the contact: > > > > > > "+e.toString()); > > > > > > } > > > > > > } > > > > > > > > } > > > > > > } > > > > > > > > First all contacts are fetched and then an extended property is > added > > > > > > in each contact and then it is updated. At this point when > > > > > > contact.update is called then exception VersionConflictException > > > > > > occurs. > > > > > > > > Please help me. Any idea why this occurs? > > > > > > > > Faisal > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
