Great Guess Frank, It worked for me.
Actually I was adding contact in user's gmail address book but scenario was, if there is no email for that user I insert some default email address since gmail does not allow adding contact with email. Now once that default email was inserted into address book at the time of second request it was giving me that error. Whatsoever I am through now. Thanks a lot for your reply, Jai :) On Jun 13, 1:05 pm, Frank Mantek <[EMAIL PROTECTED]> wrote: > Can make an educated guess. 409 conflict is returned by the contacts > api if you are trying to insert a contact that already exists. Meaning > that the contacts email is duplicate somewhere... is that possible? > > Frank > On Jun 13, 2008, at 7:51 AM, jai wrote: > > > > > Hi Frank, > > > I need your help again. :) > > > Actually That code worked fine while I was checking the functionality > > with dummy project. > > Now when I have used that code in my real application it is giving me > > an error 409 Conflict. > > > I am opening that gmail login page in an iframe. > > > Can you please help me in this regard. > > > Thanks in advance, > > Jai > > > On Jun 5, 4:33 pm, jai <[EMAIL PROTECTED]> wrote: > >> Thanks a lot Frank, > > >> My work is done. > > >> Now I need to register my application with google. > > >> Thanks again > >> Jai > > >> On Jun 5, 1:36 pm, jai <[EMAIL PROTECTED]> wrote: > > >>> AuthSubUtil.getRequestUrl(Request.Url.ToString(), > >>> "http://www.google.com/m8/feeds/default > >>> ", false, true); line > > >>> It should be ;- > >>> lnkOpenGoogle.NavigateUrl = > >>> AuthSubUtil.getRequestUrl(Request.Url.ToString(), > >>> "http://www.google.com/m8/feeds/contacts/default > >>> ", false, true); > > >>> Thanks It is working now. > > >>> Only one thing I want to confirm with you that If I am added one > >>> contact and again add that contact then will it create an > >>> exception ??? > > >>> Actually it is happening in my case. > > >>> Thanks, > >>> Jai > > >>> On Jun 5, 1:16 pm, Frank Mantek <[EMAIL PROTECTED]> wrote: > > >>>> The scope string should be: > > >>>>http://www.google.com/m8/feeds/ > > >>>> not > > >>>>http://www.google.com/m8/feeds/default > > >>>> as in your code. And you have to be registered... > > >>>> Does that help? > > >>>> Frank Mantek > >>>> Google > >>>> On Jun 5, 2008, at 8:50 AM, jai wrote: > > >>>>> Hi Frank, > > >>>>> Actually I had tried it from several angles that's why it was like > >>>>> that. > > >>>>> Now I have made changes in my code and now it is like this. > > >>>>> token = AuthSubUtil.getTokenFromReply(Request.Url); > >>>>> Session["Token"] = AuthSubUtil.exchangeForSessionToken(token, > >>>>> null); > > >>>>> GAuthSubRequestFactory authFactory = new > >>>>> GAuthSubRequestFactory("cp", > >>>>> "GmailTest"); > >>>>> authFactory.Token = (String) Session["Token"]; > > >>>>> ContactService service = new > >>>>> ContactService(authFactory.ApplicationName); > >>>>> service.RequestFactory = authFactory; > > >>>>> In this case it gives me error "Token invalid - AuthSub token has > >>>>> wrong scope" (Error 401) > > >>>>> Please help. > > >>>>> Thanks, > >>>>> Jai > > >>>>> On Jun 5, 11:22 am, Frank Mantek <[EMAIL PROTECTED]> wrote: > >>>>>> Ok, that is partly because i screwed up in making your live > >>>>>> easier. > > >>>>>> You are assuming that service.SetAuthenticationToken is setting > >>>>>> the > >>>>>> token, regardless what kind of access you are using... And it > >>>>>> should. > >>>>>> I just changed the code to do so in the future. > > >>>>>> In your version though, the SetAuthenticationToken only set's the > >>>>>> client login factories token. So your call below does nothing. > > >>>>>> But it should still work, as you are setting the token on the > >>>>>> factory > >>>>>> itself, which is the way of doing it right now. > > >>>>>> It looks like you are using the one time token though, not the > >>>>>> session > >>>>>> token ? Or is that i copy/paste error ? You should be using the > >>>>>> session token for authentication. > > >>>>>> Frank Mantek > >>>>>> Google > > >>>>>> On Jun 5, 2008, at 7:25 AM, jai wrote: > > >>>>>>> Hi Frank, > > >>>>>>> Thanks for interest. > > >>>>>>> See I first use this line to get a token. > > >>>>>>> lnkOpenGoogle.NavigateUrl = > >>>>>>> AuthSubUtil.getRequestUrl(Request.Url.ToString(), "http:// > >>>>>>>www.google.com/m8/feeds/default", false, true); > > >>>>>>> It given me one time token that i convert as a session token > >>>>>>> using > >>>>>>> following code; > > >>>>>>> token = AuthSubUtil.getTokenFromReply(Request.Url); > >>>>>>> Session["Token"] = AuthSubUtil.exchangeForSessionToken(token, > >>>>>>> null); > > >>>>>>> GAuthSubRequestFactory authFactory = new > >>>>>>> GAuthSubRequestFactory("cp", > >>>>>>> "GmailTest"); > >>>>>>> authFactory.Token = token; > > >>>>>>> ContactService service = new > >>>>>>> ContactService(authFactory.ApplicationName); > >>>>>>> service.RequestFactory = authFactory; > >>>>>>> service.SetAuthenticationToken(authFactory.Token); > > >>>>>>> After that I create a new entry for my address book by using the > >>>>>>> following code; > > >>>>>>> ContactEntry contactEntry = new ContactEntry(); > >>>>>>> contactEntry.Title.Text = "Testing"; > > >>>>>>> contactEntry.Emails.Clear(); > >>>>>>> EMail primaryEmail = new EMail("[EMAIL PROTECTED]"); > >>>>>>> primaryEmail.Address = "[EMAIL PROTECTED]"; > >>>>>>> primaryEmail.Primary = true; > >>>>>>> primaryEmail.Rel = ContactsRelationships.IsWork; > >>>>>>> contactEntry.Emails.Add(primaryEmail); > > >>>>>>> EMail secondaryEmail = new EMail("[EMAIL PROTECTED]"); > >>>>>>> secondaryEmail.Address = "[EMAIL PROTECTED]"; > >>>>>>> secondaryEmail.Rel = ContactsRelationships.IsHome; > >>>>>>> contactEntry.Emails.Add(secondaryEmail); > > >>>>>>> contactEntry.Phonenumbers.Clear(); > >>>>>>> PhoneNumber phoneNumber = new PhoneNumber("9999999999"); > >>>>>>> phoneNumber.Primary = true; > >>>>>>> phoneNumber.Rel = ContactsRelationships.IsMobile; > >>>>>>> contactEntry.Phonenumbers.Add(phoneNumber); > > >>>>>>> contactEntry.PostalAddresses.Clear(); > >>>>>>> PostalAddress postalAddress = new PostalAddress(); > >>>>>>> postalAddress.Value = "123 somewhere lane"; > >>>>>>> postalAddress.Primary = true; > >>>>>>> postalAddress.Rel = ContactsRelationships.IsHome; > >>>>>>> contactEntry.PostalAddresses.Add(postalAddress); > > >>>>>>> contactEntry.Content.Content = "Testing"; > > >>>>>>> Now when I try add the contact using following code it given me > >>>>>>> error > >>>>>>> "Token invalid - Invalid AuthSub token. (Error 401)" > > >>>>>>> Uri feedUri = new > >>>>>>> Uri(ContactsQuery.CreateContactsUri("default")); > >>>>>>> ContactEntry createdContact = > >>>>>>> (ContactEntry)service.Insert(feedUri, > >>>>>>> contactEntry); > > >>>>>>> My Assemblies are :- > >>>>>>> Google.GData.Client Version - 1.1.3.23925 > >>>>>>> Google.GData.Contacts Version - 1.1.3.23927 > >>>>>>> Google.GData.Extensions Version - 1.1.3.23925 > > >>>>>>> Thanks > >>>>>>> Jai > > >>>>>>> On Jun 4, 7:38 pm, Frank Mantek <[EMAIL PROTECTED]> wrote: > >>>>>>>> ok, so how did you get the token in the Session object? > > >>>>>>>> Frank Mantek > >>>>>>>> Google > >>>>>>>> On Jun 4, 2008, at 3:52 PM, jai wrote: > > >>>>>>>>> It say Invalid Token Error 401. > > >>>>>>>>> Thanks for your reply. > > >>>>>>>>> On Jun 4, 6:03 pm, Frank Mantek <[EMAIL PROTECTED]> wrote: > >>>>>>>>>> It would help to know if there are more details in the > >>>>>>>>>> exception > >>>>>>>>>> (check the response property). If i would have to guess it's > >>>>>>>>>> probably > >>>>>>>>>> because the base projection (which is created by the > >>>>>>>>>> createcontactsuri > >>>>>>>>>> method below) is deprecated... > > >>>>>>>>>> So try creating the Uri by hand (i am changing the .NET > >>>>>>>>>> client as > >>>>>>>>>> we > >>>>>>>>>> speak, that method will by default create a full projection > >>>>>>>>>> in > >>>>>>>>>> the > >>>>>>>>>> future). > > >>>>>>>>>> Frank Mantek > >>>>>>>>>> Google > >>>>>>>>>> On Jun 4, 2008, at 2:37 PM, jai wrote: > > >>>>>>>>>>> Hi, > > >>>>>>>>>>> Did you get any solution for the same problem. > > >>>>>>>>>>> Kindly let me know if you find any solution. > > >>>>>>>>>>> Thanks in advance, > > >>>>>>>>>>> Jai > > >>>>>>>>>>> On Apr 26, 5:03 pm, Deeraf <[EMAIL PROTECTED]> wrote: > >>>>>>>>>>>> This exception is occured when i try to run the following > >>>>>>>>>>>> code > >>>>>>>>>>>> Execution of request > >>>>>>>>>>>> failed:http://www.google.com/m8/feeds/contacts/default/base > > >>>>>>>>>>>> GAuthSubRequestFactory authFactory = new > >>>>>>>>>>>> GAuthSubRequestFactory("cp","GmailTest"); > >>>>>>>>>>>> authFactory.Token = (String)Session["token"]; > >>>>>>>>>>>> ContactService service = new > >>>>>>>>>>>> ContactService(authFactory.ApplicationName); > >>>>>>>>>>>> service.RequestFactory = authFactory; > > >>>>>>>>>>>> ContactEntry newEntry = new ContactEntry(); > >>>>>>>>>>>> newEntry.Title.Text = "Information"; > > >>>>>>>>>>>> EMail primaryEmail = new EMail("[EMAIL PROTECTED]"); > >>>>>>>>>>>> primaryEmail.Primary = true; > >>>>>>>>>>>> primaryEmail.Rel = ContactsRelationships.IsWork; > >>>>>>>>>>>> newEntry.Emails.Add(primaryEmail); > > >>>>>>>>>>>> PhoneNumber phoneNumber = new > >>>>>>>>>>>> PhoneNumber("111-111-222"); > >>>>>>>>>>>> phoneNumber.Primary = true; > >>>>>>>>>>>> phoneNumber.Rel = ContactsRelationships.IsMobile; > >>>>>>>>>>>> newEntry.Phonenumbers.Add(phoneNumber); > > >>>>>>>>>>>> newEntry.Content.Content = "Information Center"; > > >>>>>>>>>>>> Uri uriFeed = new > >>>>>>>>>>>> Uri(ContactsQuery.CreateContactsUri("default")); > >>>>>>>>>>>> ContactEntry createEntry = > >>>>>>>>>>>> (ContactEntry)service.Insert(uriFeed, newEntry); > > >>>>>>>>>>>> Last line is having exception --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Data Protocol" 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-help-dataapi?hl=en -~----------~----~----~----~------~----~------~--~---
