将数据库联系人同步到谷歌联系人会出错

时间:2016-08-12 06:07:08

标签: c# sql asp.net

我在将数据库联系人同步到谷歌联系人时收到此错误。

  

“类型

的未处理异常      

'System.Net.WebException'发生在Google.GData.Client.dll“

并在newcontact.text

中收到错误
 private void btn_synchronize_Click(object sender, EventArgs e)
        {

        RequestSettings rs = new RequestSettings("Synchronization", "abc@gmail.com", "123");
        ContactsRequest cr = new ContactsRequest(rs);


        Contact newContact = new Contact();
        newContact.Title.Text = "Liz Doe";------in.text also show error 



        EMail primaryEmail = new EMail("liz@gmail.com");
        primaryEmail.Primary = true;
        primaryEmail.Rel = ContactsRelationships.IsWork;
        newContact.Emails.Add(primaryEmail);

        EMail secondaryEmail = new EMail("liz@a.com");
        secondaryEmail.Rel = ContactsRelationships.IsHome;
        //newEntry.Emails.Add(secondaryEmail);

        PhoneNumber phoneNumber = new PhoneNumber("555-555-5555");
        phoneNumber.Primary = true;
        phoneNumber.Rel = ContactsRelationships.IsMobile;
        newContact.Phonenumbers.Add(phoneNumber);

        //PostalAddress postalAddress = new PostalAddress();
        //postalAddress.Value = "123 somewhere lane";
        //postalAddress.Primary = true;
        //postalAddress.Rel = ContactsRelationships.IsHome;
        //newContact.PostalAddresses.Add(postalAddress);

        newContact.Content = "Contact information for Liz";

        Uri feedUri = new Uri(ContactsQuery.CreateContactsUri("default"));


        Contact createdContact = cr.Insert(feedUri, newContact);//----here i am getting this error


    }


}

0 个答案:

没有答案