Creating more then one standard folder of the same type

Hello,
In the next code I try to create two standard folders in the same pst. The second create throws me and
exception that the standard folder already exists.
When I do it in Outlook there is not problem with that (2contacts.jpg)

using (PersonalStorage pst = PersonalStorage.Create("testpst.pst", FileFormatVersion.Unicode))
{
FolderInfo contacts = pst.CreatePredefinedFolder("Contacts", StandardIpmFolder.Contacts);
FolderInfo contacts2 = pst.CreatePredefinedFolder("Contacts2", StandardIpmFolder.Contacts);
}

Am I doing something wrong? Or you do not support it ?

Hi Lev,


Please accept our apology for a delayed response as we are busy in our monthly product release for Aspose.Email.

I was also able to observe this issue as you mentioned. Aspose.Email is not allowing to add multiple standard folders of the same type. However, adding multiple standard folders of the same type may also need modification where one retrieves the Predefined folder by its name such as “Contacts” as it would need differentiation between these. I have requested development team to provide their opinion in this regard and will update you as soon as there is some information available.

Hi Lev,


Thank you for being patient.

In order to investigate the possible implementation of mulitple standar folders with the same type, I have logged an investigation ticket in our issue tracking systme with issue id: NETWORKNET-33870. Development team will look into it and once I have any information available in this regard, I’ll update you here. Your patience till then is highly appreciated.

Do we have some information regarding above issue?

Hi @mrgoku

CreatePredefinedFolder method creates folders that are added by Outlook by default when it creates a new file. In other words, CreatePredefinedFolder method allows to create a minimum set of predefined folders, that will be used by Outlook by default. That’s why, AE throws exception.

In order to add one more folder for contacts for example, it is recommended to use the following code:

using (PersonalStorage pst = PersonalStorage.Create(@"D:\test.pst", FileFormatVersion.Unicode))
{
    FolderInfo contacts = pst.CreatePredefinedFolder("Contacts", StandardIpmFolder.Contacts);
    FolderInfo contacts2 = pst.RootFolder.AddSubFolder("Contacts2", contacts.ContainerClass);
}