Free Support Forum -

Get Pst folder type

I Use this code to get all folders from a pst file
foreach (FolderInfo myfolderInfo in folderInfoCollection)


but i want to get the foder type.I want to know the folder is calendar, Contact, mail folder.
How can i get this information??


Every folder contains properties available as Aspose.Email.Mapi.MapiPropertyCollection and can be accessed in Key Value Pair.
The value for “907214879” represents IPF type if available and the value of “805371935” represents folder name.

You may use the following sample code:

FolderInfo folderInfo = pst.RootFolder;
FolderInfoCollection folders = folderInfo.GetSubFolders();
foreach (FolderInfo myfolderInfo in folders)
    Console.WriteLine("Folder Name: {0}", myfolderInfo.DisplayName);
    foreach (var pro in myfolderInfo.Properties)
        Console.WriteLine($"Pair here: {pro.Key}, {pro.Value}");

We hope that this shall answer your query. Please write back to us if you need additional information or you have any further query.