Outlook.MAPIFolder FolderPath doesn't work on Outlook 2000

  • Thread starter Thread starter Sibi
  • Start date Start date
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
 
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.
 
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
 
Back
Top