Hello Azmat,
There is indeed a "bug" in the docs which should be fixed shortly. The
correct way to add an e-mail address is like that:
newEntry.Emails.Add(new EMail()
{
Primary = true,
Rel = ContactsRelationships.IsHome,
*Address = "[email protected]" // <-- Change here.*
});
Best,
Alain
On Wed, Oct 19, 2011 at 7:42 AM, HK1 <[email protected]> wrote:
> Are you sure that your ContactsRequest object (the one that gets
> passed in as the argument named cr) is working? I think that this is
> probably where you're problem is.
>
> Here's VB.Net code that works for me. You should be able to convert it
> to C# using one of those online code converters.
>
> Dim conserv As New ContactsService("MyCompany-MyApp-v1.0")
> Dim authFactory As New GDataGAuthRequestFactory("cp",
> "MyCompany-MyApp-v1.0")
> authFactory.AccountType = "GOOGLE"
> conserv.RequestFactory = authFactory
> conserv.setUserCredentials("[email protected]",
> "YourPassword")
> conserv.QueryClientLoginToken()
> Dim nc As New ContactEntry
> With nc
> .Name = New Google.GData.Extensions.Name()
> .Name.FullName = "John Davis"
> .Name.GivenName = "John"
> .Name.FamilyName = "Davis"
> End With
> Dim org As New Google.GData.Extensions.Organization()
> With org
> .Rel =
> Google.GData.Extensions.ContactsRelationships.IsWork
> .Name = "Garfield"
> .Primary = True
> End With
> nc.Organizations.Add(org)
> Dim ph As New
> Google.GData.Extensions.PhoneNumber("111-222-3333")
> With ph
> .Primary = True
> .Rel =
> Google.GData.Extensions.ContactsRelationships.IsWork
> 'I'm not sure when you need to use this
> '.Uri = "tel:+1111222333"
> End With
> nc.Phonenumbers.Add(ph)
> Dim urifeed As New
> Uri(ContactsQuery.CreateContactsUri("default"))
> conserv.Insert(urifeed, nc)
>
> On Oct 18, 4:11 am, Azmat Ali Akhtar <[email protected]> wrote:
> > Hi
> > Alian please help me resolve this Problem, iam using exact same code
> snippet
> > as in you API documentation along with that values and get error 400 bad
> > request at cr.insert() methode.
> > Please
>
> --
> You received this message because you are subscribed to the Google
> Groups "Google Contacts, Shared Contacts and User Profiles APIs" 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://code.google.com/apis/contacts/community/forum.html
>
--
Alain Vongsouvanh | Developer Programs Engineer
--
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" 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://code.google.com/apis/contacts/community/forum.html