简单问题
private void AddContact()
{
Outlook.ContactItem newContact = (Outlook.ContactItem)
this.CreateItem(Outlook.OlItemType.olContactItem);
try
{
newContact.FirstName = "Jo";
newContact.LastName = "Berry";
newContact.Email1Address = "somebody@example.com";
newContact.CustomerID = "123456";
newContact.PrimaryTelephoneNumber = "(425)555-0111";
newContact.MailingAddressStreet = "123 Main St.";
newContact.MailingAddressCity = "Redmond";
newContact.MailingAddressState = "WA";
newContact.Save();
newContact.Display(true);
}
catch
{
MessageBox.Show("The new contact was not saved.");
}
}
以上是用VISUAL STUDIO TOOL FOR OFFICE建的自动为OUTLOOK添加联系人的程序.
CreateItem这个运行不下去.是少了using哪个文件了?有用过这个函数的么?