65.9K
CodeProject 正在变化。 阅读更多。
Home

Outlook Interop,包括分发列表

starIconstarIconstarIconemptyStarIconemptyStarIcon

3.00/5 (1投票)

2009年3月2日

CPOL
viewsIcon

19858

downloadIcon

230

用于管理 Outlook 的可重用代码。

引言

显然,与 Outlook 交互的 DLL 经过多年发生了变化。 在尝试了数百篇在线提交的 Outlook interop 源代码的文章(甚至 MSDN 上的文档也相当令人困惑)后,我决定编写自己的代码。

提供的、压缩的、可用的代码非常简洁,相对容易理解,并且更易于使用。 该代码在较旧的 IBM 笔记本电脑上运行良好,操作系统为 XP-Pro,Office 版本为 2003。

使用代码

要重用该代码,请在 Visual Studio 项目中使用 ofOutlook.hofOutlook.cpp 文件。 然后,只需使用包含指令,例如在 (Form1.h) 文件中演示的那样,然后添加您希望在表单中使用的所有方法... 甚至在命令行/非 GUI 程序中使用。

解压缩后,这些文件非常小。 以下是其中一个文件的摘录

// A snippet from ofOutlook.h containing the initial declarations that 
// will identify the locations necessary for the Microsoft DLL to work.
//
private:
   static Outlook::ApplicationClass^ myOutlook = gcnew Outlook::ApplicationClass();
   static Outlook::NameSpace^ myNs = myOutlook->GetNamespace("MAPI");
   static Outlook::MAPIFolder^ folderContacts = 
          myNs->GetDefaultFolder(Outlook::OlDefaultFolders::olFolderContacts);

关注点

该代码在 12 月初对 XP 和 Office 2003 的升级时是可用的。 但您的使用情况可能会有所不同 - YMMV(对于欧洲人来说,您的消耗量可能会有所不同)。

历史

这是原始文章。

© . All rights reserved.