Hmmm, just tried it. Ok, in the regular web interface, I can add another 
entry with the same email address, but it still fails in the .NET API ...

I guess it's not totally a bad thing :)




Jesse Mandel wrote:
> Non-unique email addresses are now allowed in the Gmail contacts manager 
> 
> http://googleappsupdates.blogspot.com/2009/03/non-unique-email-addresses-now-allowed.html
> 
> 
> 
> On Mon, Feb 9, 2009 at 2:33 PM, Jesse Mandel <[email protected] 
> <mailto:[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]
>     <mailto:[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]
>         <mailto:[email protected]>> wrote:
>          > I thought duplicate emails were allowed now?
>          > -Jesse
>          >
>          > On Mon, Feb 9, 2009 at 12:59 PM, ravi181229
>         <[email protected] <mailto:[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]
>         <mailto:[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://
>         <http://schemas.google.com/gdata/batch'xmlns:gd='http://>
>          > > > schemas.google.com/g/2005
>         
> <http://schemas.google.com/g/2005>'><id>http://www.google.com/m8/feeds/contacts/
>          > > > matthias.hirschfeld%40googlemail.com/base/1f68ced8851eb52
>         <http://40googlemail.com/base/1f68ced8851eb52></
>          > > > id><updated>2009-01-29T13:34:51.756Z</updated><category
>         scheme='http://
>          > > > schemas.google.com/g/2005#kind
>         <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/
>         <http://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'/
>         <http://40googlemail.com/full/1f68ced8851eb52'/>
>          > > > ><link rel='edit' type='application/atom+xml' href='http://
>          >
>          >
>          
> >www.google.com/m8/feeds/contacts/matthias.hirschfeld%40googlemail.com.
>         
> <http://www.google.com/m8/feeds/contacts/matthias.hirschfeld%40googlemail.com.>..
>          > > ><gd:email
>          > > > rel='http://schemas.google.com/g/2005#other'
>          > > > address='[email protected]
>         <mailto:[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
> 
> 
> 
> 
> > 


-- 
Andre -- The police never think it's as funny as you do.

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