PersonalStorage.create(InputStream- int) behavior

What is the behavior of PersonalStorage.create(InputStream, int)? Specifically, is it possible to use it (or any other method) to create an in-memory PST without writing data to disk?

This message was posted using Page2Forum from [/community/public/documentation](https://forum.aspose.com/community/public/documentation)

Hi Abraham,

Thank you for using Aspose.Email.

The statement PersonalStorage.create(Stream, FileFormatVersion) creates a new PST in memory without writing its data to disc. The PST object can then be used to add sub-folders and messages to it as it would be any file that is created on disc. Please have a look at the following code which creates a PST in memory stream and then adds a MSG to one of the sub-folders created in it.

MemoryStream ms = new MemoryStream();
PersonalStorage pst = PersonalStorage.Create(ms, FileFormatVersion.Unicode);

//Add sub folders to this PST
pst.RootFolder.AddSubFolder("Inbox");
pst.RootFolder.AddSubFolder("Test");

//Get reference to the Test folder
FolderInfo folderInfo = pst.RootFolder.GetSubFolder("Test");

//Add a msg to the Test folder
MapiMessage mapiMsg = MapiMessage.FromFile("AsposeMsg.msg");
folderInfo.AddMessage(mapiMsg);

//Display the contents of the Test folder
// display the folder name
Console.WriteLine("Folder: " + folderInfo.DisplayName);
Console.WriteLine("==================================");

// display information about messages inside this folder
MessageInfoCollection messageInfoCollection = folderInfo.GetContents();
foreach (MessageInfo messageInfo in messageInfoCollection)
{
    Console.WriteLine("Subject: " + messageInfo.Subject);
    Console.WriteLine("Sender: " + messageInfo.SenderRepresentativeName);
    Console.WriteLine("Recipients: " + messageInfo.DisplayTo);
    Console.WriteLine("------------------------------");
}

Thank you for the response, Kashif. But my question was in regard to the Java method:
public static PersonalStorage create(InputStream stream, int version)

That is listed on the following page:

Thanks.

Hi,


Thank you for the feedback.

It seems to me an incorrect method interface implementation of PesonalStorage.Create i.e. instead of InputStream, it should have been OutputStream. Anyways, I have logged this issue in our issue tracking system for our development team to look into it and provide further assistance. We will soon update you here about our findings and appreciate your patience in this regard.

The issue has been logged as: NETWRKJAVA-33192.

The issues you have found earlier (filed as NETWRKJAVA-33192) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.