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/full/1f68ced8851eb52/1233236091756000'/
> ><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
-~----------~----~----~----~------~----~------~--~---

Reply via email to