分类:
2008-10-13 16:09:16
using(ItemContext ctx = ItemContext.Open()) { Folder myDataFolder = UserDataFolder.FindMyPersonalContactsFolder(ctx); using (FindResult result = myDataFolder.GetAllMembers()) { foreach (object o in result) { Person person = o as Person; if (person == null) continue; if (person.DisplayName == "Richard Grimes") { // use person here break; } } } }
Person person = Person.CreatePersonalContact(ctx); person.DisplayName = "Richard Edwards"; SmtpEmailAddress email; email = new SmtpEmailAddress("dai@parkfarm.com"); email.Categories.Add(GeneralCategories.Home); person.PersonalEmailAddresses.Add(email); person.Save(); person = Person.CreatePersonalContact(ctx); person.DisplayName = "Roberto Marchini"; email = new SmtpEmailAddress("rob@robshouse.com"); email.Categories.Add(GeneralCategories.Home); person.PersonalEmailAddresses.Add(email); person.Save();
Person person = Person.CreatePersonalContact(ctx); person.DisplayName = "Richard Edwards"; SmtpEmailAddress email; email = new SmtpEmailAddress("dai@parkfarm.com"); email.Categories.Add(new CategoryRef(GeneralCategories.Home)); person.PersonalEmailAddresses.Add(email); person.Save(); person = Person.CreatePersonalContact(ctx); person.DisplayName = "Roberto Marchini"; email = new SmtpEmailAddress("rob@robshouse.com"); email.Categories.Add(new CategoryRef(GeneralCategories.Home)); person.PersonalEmailAddresses.Add(email); person.Save();