MAPIFolder deprecated so workaround for Outlook programming?
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.
精彩评论