标签:des style blog http io os ar for 数据
原文:C# 对Outlook联系人的增、删、查 [转]
注:定义变量
Outlook.Application myOlApp = new
Outlook.ApplicationClass();
Outlook.NameSpace myNameSpace;
Outlook.MAPIFolder myFolder;
一、添加联系人
Outlook.ContactItem addItem =
(Outlook.ContactItem)myOlApp.CreateItem(Outlook.OlItemType.olContactItem);
addItem.FirstName = "晶晶";
addItem.LastName = "李";
addItem.Email1Address = "sun@sohu.com";
addItem.Save();
二、删除联系人
Outlook.ContactItem contact =
GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts).
Items.
Find(
string.Format("[LastName]=‘{0}‘ AND [FirstName]=‘{1}‘",
lastName, firstName))
as Outlook.ContactItem;
if (contact != null)
{
}
三、查询联系人