Free Support Forum -

How to delete a message folder inside PST file

I would like some help on deleting an empty message folder from a PST file.

Thank you for your request. You can delete a folder from a PST file using Aspose.Email as follows:

// C#
FolderInfo folderInfo = personalStorage.RootFolder.GetSubFolder("folder_name");

API Reference: FolderInfo.DeleteChildItem Method

// Java
FolderInfo folderInfo = personalStorage.getRootFolder().getSubFolder("folder_name");

API Reference: FolderInfo.deleteChildItem method

1 Like


After deleting the folder according to your instructions, Microsoft Outlook still shows it when I open the PST file, but now it displays the error screen attached below…

screen1.png (43.4 KB)

What can I do to solve this?


Could you share your code snippet and a PST file sample that can be used for investigating the problem, please? Also, please specify the version of Aspose.Email which you use.


I found an issue in my code when deleting folders, it seems OK now using your example.
If I need anything else, I will let you know.

Thank you very much for your help!

Sure, I am glad you found the cause of this problem.