Exemple #1
0
        public void TestCreatingGoogeAccountThatFailed2()
        {
            Outlook.ContactItem outlookContact = sync.OutlookContacts.Find(
                string.Format("[FirstName]='{0}' AND [LastName]='{1}'",
                              ConfigurationManager.AppSettings["Test.FirstName"],
                              ConfigurationManager.AppSettings["Test.LastName"])) as Outlook.ContactItem;

            ContactMatch match = FindMatch(outlookContact);

            Assert.IsNotNull(match);
            Assert.IsNull(match.GoogleContact);

            ContactEntry googleContact = new ContactEntry();

            //ContactSync.UpdateContact(outlookContact, googleContact);

            googleContact.Title.Text = outlookContact.FileAs;

            if (googleContact.Title.Text == null)
            {
                googleContact.Title.Text = outlookContact.FullName;
            }

            if (googleContact.Title.Text == null)
            {
                googleContact.Title.Text = outlookContact.CompanyName;
            }

            ContactSync.SetEmails(outlookContact, googleContact);

            //SetPhoneNumbers(outlookContact, googleContact);

            //SetAddresses(outlookContact, googleContact);

            //SetCompanies(outlookContact, googleContact);

            //SetIMs(outlookContact, googleContact);

            googleContact.Content.Content = outlookContact.Body;

            Uri          feedUri      = new Uri(ContactsQuery.CreateContactsUri("default"));
            ContactEntry createdEntry = (ContactEntry)sync.GoogleService.Insert(feedUri, googleContact);

            ContactPropertiesUtils.SetOutlookGoogleContactId(sync, match.OutlookContact, createdEntry);
            match.GoogleContact = createdEntry;
            match.OutlookContact.Save();
        }
Exemple #2
0
        public void TestUpdatingGoogeAccountThatFailed()
        {
            Outlook.ContactItem outlookContact = sync.OutlookContacts.Find(
                string.Format("[FirstName]='{0}' AND [LastName]='{1}'",
                              ConfigurationManager.AppSettings["Test.FirstName"],
                              ConfigurationManager.AppSettings["Test.LastName"])) as Outlook.ContactItem;

            ContactMatch match = FindMatch(outlookContact);

            Assert.IsNotNull(match);
            Assert.IsNotNull(match.GoogleContact);

            ContactEntry googleContact = match.GoogleContact;

            ContactSync.UpdateContact(outlookContact, googleContact);

            googleContact.Title.Text = outlookContact.FileAs;

            if (googleContact.Title.Text == null)
            {
                googleContact.Title.Text = outlookContact.FullName;
            }

            if (googleContact.Title.Text == null)
            {
                googleContact.Title.Text = outlookContact.CompanyName;
            }

            ContactSync.SetEmails(outlookContact, googleContact);

            ContactSync.SetPhoneNumbers(outlookContact, googleContact);

            //SetAddresses(outlookContact, googleContact);

            //SetCompanies(outlookContact, googleContact);

            //SetIMs(outlookContact, googleContact);

            //googleContact.Content.Content = outlookContact.Body;

            ContactEntry updatedEntry = googleContact.Update() as ContactEntry;

            ContactPropertiesUtils.SetOutlookGoogleContactId(sync, match.OutlookContact, updatedEntry);
            match.GoogleContact = updatedEntry;
            match.OutlookContact.Save();
        }