开发者

MAPIFolder deprecated so workaround for Outlook programming?

开发者 https://www.devze.com 2023-03-10 09:22 出处:网络
MSDN says this of the MAPIFolder interface (Outlook programming with WPF): This interface is deprecated; do not

MSDN says this of the MAPIFolder interface (Outlook programming with WPF):

This interface is deprecated; do not use this interface. Instead use the inter开发者_如何学JAVAface Folder to access all method, property, and event members of the COM object Folder.

I am trying to get the Drafts folder like so:

Outlook.MAPIFolder oFolder = olNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderDrafts);

How do I do the above without using the MAPIFolder (which is deprecated)? I guess I don't understand what MSDN is saying (using the Folder interface to access all method etc)


You simply cast it to Outlook.Folder, i.e.

Outlook.Folder oFolder = (Outlook.Folder) olNS.GetDefaultFolder( Outlook.OlDefaultFolders.olFoderDrafts)

Admittedly, the MSDN is rather unclear there. You can think of the Folder interface as a wrapper around the MAPIFolder, with additional support for events.

As I sidenote, I would take the whole 'deprecated' thing with a grain of salt. I'd bet MAPIFolder is here to stay, at least for a couple more versions of Outlook.

0

精彩评论

暂无评论...
验证码 换一张
取 消