简单问题

qinyi0002 2008-01-28 02:37:21
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哪个文件了?有用过这个函数的么?
...全文
70 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
liutaoyue 2008-01-28
  • 打赏
  • 举报
回复
你是不是引用了微软OFFICE里面的DLL啊,类似于用了EXCEL.DLL
命名空间using Excel;
OutLook类似吧...

110,537

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧