public void TestExtendedProps() { sync.SyncOption = SyncOption.MergeOutlookWins; string timestamp = DateTime.Now.Ticks.ToString(); string name = "AN OUTLOOK TEST CONTACT"; string email = "*****@*****.**"; name = name.Replace(" ", "_"); // delete previously failed test contacts DeleteExistingTestContacts(name, email); sync.Load(); ContactsMatcher.SyncContacts(sync); // create new contact to sync Outlook.ContactItem outlookContact = sync.OutlookApplication.CreateItem(Outlook.OlItemType.olContactItem) as Outlook.ContactItem; outlookContact.FullName = name; outlookContact.FileAs = name; outlookContact.Email1Address = email; outlookContact.Email2Address = email.Replace("00", "01"); outlookContact.Email3Address = email.Replace("00", "02"); outlookContact.HomeAddress = "10 Parades"; outlookContact.PrimaryTelephoneNumber = "123"; outlookContact.Save(); ContactEntry googleContact = new ContactEntry(); ContactSync.UpdateContact(outlookContact, googleContact); ContactMatch match = new ContactMatch(outlookContact, googleContact); sync.SaveGoogleContact(match); // read contact from google googleContact = null; sync.Load(); ContactsMatcher.SyncContacts(sync); foreach (ContactMatch m in sync.Contacts) { if (m.GoogleContact.Title.Text == name) { googleContact = m.GoogleContact; break; } } // get extended prop Assert.AreEqual(ContactPropertiesUtils.GetOutlookId(outlookContact), ContactPropertiesUtils.GetGoogleOutlookContactId(sync.SyncProfile, googleContact)); //delete test contacts match.Delete(); }
public void TestCreatingGoogeAccountThatFailed3() { 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; } //SetEmails(outlookContact, googleContact); ContactSync.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(); }
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(); }