MAPIFolder deprecated so workaround for Outlook programming?
Asked Answered
H

1

3

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

This interface is deprecated; do not use this interface. Instead use the interface 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)

Horrified answered 2/6, 2011 at 11:9 Comment(0)
R
5

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.

Revivalism answered 2/6, 2011 at 11:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.