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("
yourem...@gmail.com",
"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)