Outlook.MAPIFolder FolderPath doesn't work on Outlook 2000

S

Sibi

Hi there,

iam launching following C# code:

/****************************************************************/
string Folder = String.Empty;
Outlook.Application oApplication = new Outlook.ApplicationClass();
Outlook.NameSpace oNameSpace =oApplication.GetNamespace("mapi");
Outlook.MAPIFolder oMAPIFolder = oNameSpace.PickFolder();

//Works on Outlook 2003 great, returns nothing on Outlook 2000
Folder = oMAPIFolder.FolderPath;

/***************************************************************/

The code works as expected on Outlook 2003 and returns the folder
selected by the user. Same piece of code return nothing when working
with Outlook 2000. Why? Is this a bug described in some KB article? Is
there a workaround for the problem?

Thanks for input!

Regards Sibi
 
S

Sue Mosher [MVP-Outlook]

It's not a bug. The FolderPath property was added to the Outlook object model in Outlook 2002. In Outlook 2000, you can construct the path by walking up the folder hierarchy using the Parent property of each folder.
 
S

Sibi

Hello Sue,
thanks for response!

under Outlook 2000 the MAPIFolder.Name property does work (lucky me),
so you can easilly construct the full folder path after the user picked
a folder.



/************************************************************/
string Folder = String.Empty;
string pickedFolder = String.Empty;

Outlook.Application oApplication = new Outlook.ApplicationClass();
Outlook.NameSpace oNameSpace =oApplication.GetNamespace("mapi");
Outlook.MAPIFolder oMAPIFolder = oNameSpace.PickFolder();

//picked folder
pickedFolder = oMAPIFolder.Name;

//Parent folder of picked folder
oMAPIFolder =(Outlook.MAPIFolder)oMAPIFolder.Parent;
Folder = oMAPIFolder.Name;


//Release ressources
oNameSpace.Logoff();
oNameSpace = null;
GC.Collect();
/************************************************************/


bye
Sibi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top