我有这个“简单”的 Outlook 对象:
Outlook.Explorer olExplorer = this.Application.ActiveExplorer();
在“ThisAddin_StartUp”中,我将olExplorer.FolderSwitch事件注册到函数 olExplorer_FolderSwitch()。我必须从当前文件夹创建一个 Outlook 文件夹对象:
Outlook.Folder f = olExplorer.CurrentFolder as Outlook.Folder;
但是:属性 "CurrentFolder" 属于 MAPIFolder 类型,不能用作Outlook.Folder。如何将 CurrentFolder-Property“投射”到 Outlook.Folder?- 不丢失事件处理程序?如果我做这个简单的转换,对象f将不会触发事件 BeforeItemMove - 因为f是 NULL 而 olExplorer.CurrentFolder 不是