PersonalStorage

Inheritance: java.lang.Object

All Implemented Interfaces: com.aspose.ms.System.IDisposable, java.io.Closeable

public class PersonalStorage implements System.IDisposable, Closeable

Provides functionality to access and manipulate the PST (Personal Storage Table) files used by Microsoft Outlook.

The PersonalStorage class encapsulates methods for creating, opening, and working with the contents of PST files including emails, appointments, contacts, tasks, and other personal information.

Example:


 // Open the PST file by creating an instance of PersonalStorage
 try (PersonalStorage pst = PersonalStorage.fromFile("storage.pst")) {
     // Retrieve the total number of items in the PST file
     int totalItemsCount = pst.getStore().getTotalItemsCount();

     // Write the total items count to the console
     System.out.println("Total items count: " + totalItemsCount);

     // Iterate through each subfolder within the root folder of the PST
     for (FolderInfo folderInfo : pst.getRootFolder().getSubFolders()) {
         // Write the display name of the folder to the console
         System.out.println("Folder: " + folderInfo.getDisplayName());
         // Write the total number of items in the folder to the console
         System.out.println("Total items: " + folderInfo.getContentCount());
         // Write the count of unread items in the folder to the console
         System.out.println("Total unread items: " + folderInfo.getContentUnreadCount());

         // Enumerate through each message in the current folder
         for (MessageInfo messageInfo : folderInfo.enumerateMessages()) {
             // Write the subject of the message to the console
             System.out.println("Subject: " + messageInfo.getSubject());

             // Extract the full message object from the messageInfo
             MapiMessage msg = pst.extractMessage(messageInfo);

             // Save the message as a .msg file, using its subject as the filename
             msg.save(msg.getSubject() + ".msg");
         }
     }
 } catch (Exception e) {
     e.printStackTrace();
 }
 

Constructors

ConstructorDescription
PersonalStorage(TraversalExceptionsCallback callback)Initializes a new instance of the PersonalStorage class.

Fields

FieldDescription
ItemMovedOccurs when an item is moved to the another folder.
StorageProcessedOccurs in splitting and merging operations when a new chunk of pst is created or the next file is processed and is to be merged.
StorageProcessingOccurs before the srorage is processed.

Methods

MethodDescription
canWrite()Gets a value indicating whether the current pst supports writing.
changeMessage(String entryId, MapiPropertyCollection updatedProperties)Changes the message properties.
close()
convertTo(int format)Converts the current object to the specified format.
create(System.IO.Stream stream, int version)Creates the PST in a stream.
create(System.IO.Stream stream, int version, boolean leaveStreamOpen)Creates the PST in a stream.
create(OutputStream stream, int version)Creates the PST in a stream.
create(OutputStream stream, int version, boolean leaveStreamOpen)Creates the PST in a stream.
create(OutputStream stream, int blockSize, int version)Creates the PST in a stream.
create(String fileName, int version)Creates the new PST file with the specified file name.
create(SeekableByteChannel channel, int version)Creates the PST in a java.nio.channels.
createPredefinedFolder(String name, int defaultFolder)Creates the standard interpersonal message (IPM) folder.
createPredefinedFolder(String name, int defaultFolder, boolean createHierarchy)Creates the standard interpersonal message (IPM) folder.
deleteItem(String entryId)Deletes the item (folder or message) by it’s entryId
dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
enumerateMessages(String entryId)Exposes the enumerator, which supports an iteration of messages in folder.
enumerateMessages(String entryId, int startIndex, int count)Exposes the enumerator, which supports an iteration of messages in folder.
equals(Object arg0)
extractAttachments(MessageInfo messageInfo)Extracts the attachments.
extractAttachments(String entryId)Extracts the attachments.
extractMessage(byte[] entryId)Get the message from PST.
extractMessage(MessageInfo messageInfo)Get the message from PST.
extractMessage(String entryId)Get the message from PST.
extractProperty(byte[] entryId, long tag)Gets the specified property of item, without extract the item fully.
extractRecipients(MessageInfo messageInfo)Extracts the recipients.
extractRecipients(String entryId)Extracts the recipients.
findAndExtractSoftDeletedItems()Finds and extracts soft-deleted messages from the PST.
findMessages(String parentEntryId)Finds the identifiers of messages for for the current folder.
findSubfolders(String parentEntryId)Finds the identifiers of subfolders for for the current folder.
fromFile(String fileName)Load PST from file.
fromFile(String fileName, boolean writable)Load PST from file.
fromFile(String fileName, PersonalStorageLoadOptions loadOptions)Load PST from file.
fromStream(System.IO.Stream stream)Load PST from stream.
fromStream(System.IO.Stream stream, boolean writable)Load PST from stream.
fromStream(System.IO.Stream stream, PersonalStorageLoadOptions loadOptions)Load PST from stream.
fromStream(InputStream stream)Load PST from stream.
fromStream(InputStream stream, boolean writable)Load PST from stream.
fromStream(InputStream stream, PersonalStorageLoadOptions loadOptions)Load PST from stream.
getCategories()Retrieves a list of PST item categories, each containing a name and associated color.
getClass()
getFolderById(byte[] entryId)Gets the personal folder from PST.
getFolderById(String entryIdString)Gets the personal folder from PST.
getFormat()Gets the file format.
getParentFolder(byte[] entryId)Gets the parent folder of message.
getParentFolder(String entryIdString)Gets the parent folder of message.
getPredefinedFolder(int defaultFolder)Gets the standard interpersonal message (IPM) folder from PST.
getRootFolder()Gets the root folder of PST.
getStore()Gets the PST message store.
hashCode()
isUnicode()Gets a value indicating whether the PST file format is Unicode.
load(System.IO.Stream stream)Load PST from stream.
load(InputStream stream)Load PST from stream.
load(String fileName)Load PST from file.
mergeWith(InputStream[] sourceStreams)Merges the pst storage with one or more other pst streams.
mergeWith(String[] sourceFileNames)Merges the pst storage with one or more other pst files.
moveItem(FolderInfo folder, FolderInfo newFolder)Moves a specified folder to a new parent folder within the current pst.
moveItem(MessageInfo message, FolderInfo newFolder)Moves a specified message to a new folder within the current pst.
notify()
notifyAll()
saveAs(OutputStream stream, int format)Saves the current object to a specified file format in a stream.
saveAs(String fileName, int format)Saves the current object to a specified file format in a different file.
saveMessageToFile(String entryId, String fileName)saveMessageToFile.
saveMessageToStream(String entryId, OutputStream stream)Saves the message, with specified entryID, to a stream.
splitInto(System.Collections.Generic.IGenericList criteria, String path)Splits the pst storage based on criteria.
splitInto(System.Collections.Generic.IGenericList criteria, String partFileNamePrefix, String path)Splits the pst storage based on criteria.
splitInto(long chunkSize, String path)Splits the pst storage into less sized parts.
splitInto(long chunkSize, String partFileNamePrefix, String path)Splits the pst storage into less sized parts.
toString()
tryToGetFolderById(String entryIdString, FolderInfo[] folder)Gets the folder associated with the specified entry ID.
tryToSaveMessage(String entryId, OutputStream stream)Saves the message, with specified entryID, to a stream.
wait()
wait(long arg0)
wait(long arg0, int arg1)

PersonalStorage(TraversalExceptionsCallback callback)

public PersonalStorage(TraversalExceptionsCallback callback)

Initializes a new instance of the PersonalStorage class. Allows setting a callback method for handling exceptions that occur during PST traversal.

Parameters:

ParameterTypeDescription
callbackTraversalExceptionsCallbackThe exception callback.

ItemMoved

public final Event<ItemMovedEventHandler> ItemMoved

Occurs when an item is moved to the another folder.

StorageProcessed

public final Event<StorageProcessedEventHandler> StorageProcessed

Occurs in splitting and merging operations when a new chunk of pst is created or the next file is processed and is to be merged.

StorageProcessing

public final Event<StorageProcessingEventHandler> StorageProcessing

Occurs before the srorage is processed. The event is raised before processing the next storage in merging or splitting operations.

canWrite()

public final boolean canWrite()

Gets a value indicating whether the current pst supports writing.

Returns: boolean

changeMessage(String entryId, MapiPropertyCollection updatedProperties)

public final void changeMessage(String entryId, MapiPropertyCollection updatedProperties)

Changes the message properties.

Parameters:

ParameterTypeDescription
entryIdjava.lang.StringThe entry identifier of message.
updatedPropertiesMapiPropertyCollectionThe updated properties.

close()

public void close()

convertTo(int format)

public final void convertTo(int format)

Converts the current object to the specified format.

Parameters:

ParameterTypeDescription
formatintThe FileFormat to convert the current object to.

It is used for the fast OST to PST conversion. The method doesn’t support conversion of OST created by MS Office 2013 and later versions. To convert an OST of later version, create a new PST and use the #mergeWith(Stream[]).mergeWith(Stream[]) method. |

create(System.IO.Stream stream, int version)

public static PersonalStorage create(System.IO.Stream stream, int version)

Creates the PST in a stream.

Parameters:

ParameterTypeDescription
streamcom.aspose.ms.System.IO.StreamThe stream in which PST is created.
versionintThe PST file version.

Note, only Unicode file version creation is supported now. |

Returns: PersonalStorage - A PersonalStorage object that represents the new PST.

create(System.IO.Stream stream, int version, boolean leaveStreamOpen)

public static PersonalStorage create(System.IO.Stream stream, int version, boolean leaveStreamOpen)

Creates the PST in a stream.

Parameters:

ParameterTypeDescription
streamcom.aspose.ms.System.IO.StreamThe stream in which PST is created.
versionintThe PST file version.
leaveStreamOpenbooleanLeave stream open when PersonalStorage is disposed.

Note, only Unicode file version creation is supported now. |

Returns: PersonalStorage - A PersonalStorage object that represents the new PST.

create(OutputStream stream, int version)

public static PersonalStorage create(OutputStream stream, int version)

Creates the PST in a stream.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamThe stream in which PST is created.
versionintThe PST file version.

Note, only Unicode file version creation is supported now. |

Returns: PersonalStorage - A PersonalStorage object that represents the new PST.

create(OutputStream stream, int version, boolean leaveStreamOpen)

public static PersonalStorage create(OutputStream stream, int version, boolean leaveStreamOpen)

Creates the PST in a stream.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamThe stream in which PST is created.
versionintThe PST file version.
leaveStreamOpenbooleanLeave stream open when PersonalStorage is disposed.

Note, only Unicode file version creation is supported now. |

Returns: PersonalStorage - A PersonalStorage object that represents the new PST.

create(OutputStream stream, int blockSize, int version)

public static PersonalStorage create(OutputStream stream, int blockSize, int version)

Creates the PST in a stream.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamThe stream in which PST is created.
blockSizeintThe optimal block size to expand cache buffer(in bytes).
versionintThe PST file version.

Note, only Unicode file version creation is supported now. |

Returns: PersonalStorage - A PersonalStorage object that represents the new PST.

create(String fileName, int version)

public static PersonalStorage create(String fileName, int version)

Creates the new PST file with the specified file name.

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringThe full name of the file.
versionintThe PST file version.

Note, only Unicode file version creation is supported now. |

Returns: PersonalStorage - A PersonalStorage object that represents the new PST.

create(SeekableByteChannel channel, int version)

public static PersonalStorage create(SeekableByteChannel channel, int version)

Creates the PST in a java.nio.channels.

Parameters:

ParameterTypeDescription
channeljava.nio.channels.SeekableByteChannelThe java.nio.channel in which PST is created.
versionintThe PST file version.

Note, only Unicode file version creation is supported now. |

Returns: PersonalStorage - A PersonalStorage object that represents the new PST.

createPredefinedFolder(String name, int defaultFolder)

public final FolderInfo createPredefinedFolder(String name, int defaultFolder)

Creates the standard interpersonal message (IPM) folder.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name of folder.
defaultFolderintThe value of StandardIpmFolder enumeration.

Returns: FolderInfo - A FolderInfo object that represents a standard IPM folder.

createPredefinedFolder(String name, int defaultFolder, boolean createHierarchy)

public final FolderInfo createPredefinedFolder(String name, int defaultFolder, boolean createHierarchy)

Creates the standard interpersonal message (IPM) folder.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name of folder.
defaultFolderintThe value of StandardIpmFolder enumeration.
createHierarchybooleanif set to true , it is possible to create a folder hierarchy using string notation. Backslash (’\’) is used as path separator.

Returns: FolderInfo - A FolderInfo object that represents a standard IPM folder.

deleteItem(String entryId)

public final void deleteItem(String entryId)

Deletes the item (folder or message) by it’s entryId

Parameters:

ParameterTypeDescription
entryIdjava.lang.String

dispose()

public final void dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

enumerateMessages(String entryId)

public final System.Collections.Generic.IGenericEnumerable<MessageInfo> enumerateMessages(String entryId)

Exposes the enumerator, which supports an iteration of messages in folder.

Parameters:

ParameterTypeDescription
entryIdjava.lang.StringThe string that represents a parent folder entry ID.

Returns: com.aspose.ms.System.Collections.Generic.IGenericEnumerable<com.aspose.email.MessageInfo> - System.Collections.Generic.IEnumerableltTgt , that represents an enumerator that iterates through a messages in folder.

enumerateMessages(String entryId, int startIndex, int count)

public final System.Collections.Generic.IGenericEnumerable<MessageInfo> enumerateMessages(String entryId, int startIndex, int count)

Exposes the enumerator, which supports an iteration of messages in folder.

Parameters:

ParameterTypeDescription
entryIdjava.lang.StringThe string that represents a parent folder entry ID.
startIndexintThe start message index.
countintThe number of messages that will be retrieved.

Returns: com.aspose.ms.System.Collections.Generic.IGenericEnumerable<com.aspose.email.MessageInfo> - System.Collections.Generic.IEnumerableltTgt , that represents an enumerator that iterates through a messages in folder.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

extractAttachments(MessageInfo messageInfo)

public final MapiAttachmentCollection extractAttachments(MessageInfo messageInfo)

Extracts the attachments.

Parameters:

ParameterTypeDescription
messageInfoMessageInfoThe message information.

Returns: MapiAttachmentCollection - The MapiAttachmentCollection that represents the collection of attachments.

extractAttachments(String entryId)

public final MapiAttachmentCollection extractAttachments(String entryId)

Extracts the attachments.

Parameters:

ParameterTypeDescription
entryIdjava.lang.StringThe message entryId.

Returns: MapiAttachmentCollection - The MapiAttachmentCollection that represents the collection of attachments.

extractMessage(byte[] entryId)

public final MapiMessage extractMessage(byte[] entryId)

Get the message from PST.

Parameters:

ParameterTypeDescription
entryIdbyte[]EntryId of message.

Returns: MapiMessage - A MapiMessage object.

extractMessage(MessageInfo messageInfo)

public final MapiMessage extractMessage(MessageInfo messageInfo)

Get the message from PST.

Parameters:

ParameterTypeDescription
messageInfoMessageInfoA MessageInfo object that represents information about message.

Returns: MapiMessage - A MapiMessage object.

extractMessage(String entryId)

public final MapiMessage extractMessage(String entryId)

Get the message from PST.

Parameters:

ParameterTypeDescription
entryIdjava.lang.StringString representation of EntryId.

Returns: MapiMessage - A MapiMessage object.

extractProperty(byte[] entryId, long tag)

public final MapiProperty extractProperty(byte[] entryId, long tag)

Gets the specified property of item, without extract the item fully.

Parameters:

ParameterTypeDescription
entryIdbyte[]The entry id of item.
taglongThe property tag.

If a property is not found, null is returned. |

Returns: MapiProperty - The MapiProperty.

extractRecipients(MessageInfo messageInfo)

public final MapiRecipientCollection extractRecipients(MessageInfo messageInfo)

Extracts the recipients.

Parameters:

ParameterTypeDescription
messageInfoMessageInfoThe message information.

Returns: MapiRecipientCollection - The MapiRecipientCollection that represents the collection of recipients.

extractRecipients(String entryId)

public final MapiRecipientCollection extractRecipients(String entryId)

Extracts the recipients.

Parameters:

ParameterTypeDescription
entryIdjava.lang.StringThe message entryId.

Returns: MapiRecipientCollection - The MapiRecipientCollection that represents the collection of recipients.

findAndExtractSoftDeletedItems()

public final System.Collections.Generic.IGenericList<RestoredItemEntry> findAndExtractSoftDeletedItems()

Finds and extracts soft-deleted messages from the PST.

Returns: com.aspose.ms.System.Collections.Generic.IGenericList<com.aspose.email.RestoredItemEntry> - A list of RestoredItemEntry objects, each containing a soft-deleted message and the folder Id it was originally located in.

findMessages(String parentEntryId)

public final System.Collections.Generic.IGenericList<String> findMessages(String parentEntryId)

Finds the identifiers of messages for for the current folder. It might be useful in case of reading corrupted pst when the GetContents and EnumerateMessages methods could throw an exception.

Parameters:

ParameterTypeDescription
parentEntryIdjava.lang.StringEntry id of the parent folder.

Returns: com.aspose.ms.System.Collections.Generic.IGenericList<java.lang.String> - Collection of entry Ids.

findSubfolders(String parentEntryId)

public final System.Collections.Generic.IGenericList<String> findSubfolders(String parentEntryId)

Finds the identifiers of subfolders for for the current folder. It might be useful in case of reading corrupted pst when the GetSubfolders and EnumerateFolders methods could throw an exception.

Parameters:

ParameterTypeDescription
parentEntryIdjava.lang.StringEntry id of the parent folder.

Returns: com.aspose.ms.System.Collections.Generic.IGenericList<java.lang.String> - Collection of entry Ids.

fromFile(String fileName)

public static PersonalStorage fromFile(String fileName)

Load PST from file.

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringName of .pst file.

By default, the pst will support writing. |

Returns: PersonalStorage - A PersonalStorage object that represents the current PST.

fromFile(String fileName, boolean writable)

public static PersonalStorage fromFile(String fileName, boolean writable)

Load PST from file.

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringName of .pst file.
writablebooleanif set to true then the the pst file will support writing, otherwise it will be opened in read-only mode.

Returns: PersonalStorage - A PersonalStorage object that represents the current PST.

fromFile(String fileName, PersonalStorageLoadOptions loadOptions)

public static PersonalStorage fromFile(String fileName, PersonalStorageLoadOptions loadOptions)

Load PST from file.

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringName of .pst file.
loadOptionsPersonalStorageLoadOptionsThe load options.

Returns: PersonalStorage - A PersonalStorage object that represents the current PST.

fromStream(System.IO.Stream stream)

public static PersonalStorage fromStream(System.IO.Stream stream)

Load PST from stream.

Parameters:

ParameterTypeDescription
streamcom.aspose.ms.System.IO.StreamThe System.IO.Stream.

By default, the pst will support writing. |

Returns: PersonalStorage - A PersonalStorage object that represents the current PST.

fromStream(System.IO.Stream stream, boolean writable)

public static PersonalStorage fromStream(System.IO.Stream stream, boolean writable)

Load PST from stream.

Parameters:

ParameterTypeDescription
streamcom.aspose.ms.System.IO.StreamThe System.IO.Stream.
writablebooleanif set to true then the the pst will support writing, otherwise it will be opened in read-only mode.

Returns: PersonalStorage - A PersonalStorage object that represents the current PST.

fromStream(System.IO.Stream stream, PersonalStorageLoadOptions loadOptions)

public static PersonalStorage fromStream(System.IO.Stream stream, PersonalStorageLoadOptions loadOptions)

Load PST from stream.

Parameters:

ParameterTypeDescription
streamcom.aspose.ms.System.IO.StreamThe System.IO.Stream.
loadOptionsPersonalStorageLoadOptionsThe load options.

Returns: PersonalStorage - A PersonalStorage object that represents the current PST.

fromStream(InputStream stream)

public static PersonalStorage fromStream(InputStream stream)

Load PST from stream.

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe System.IO.Stream.

By default, the pst will support writing. |

Returns: PersonalStorage - A PersonalStorage object that represents the current PST.

fromStream(InputStream stream, boolean writable)

public static PersonalStorage fromStream(InputStream stream, boolean writable)

Load PST from stream.

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe System.IO.Stream.
writablebooleanif set to true then the the pst will support writing, otherwise it will be opened in read-only mode.

Returns: PersonalStorage - A PersonalStorage object that represents the current PST.

fromStream(InputStream stream, PersonalStorageLoadOptions loadOptions)

public static PersonalStorage fromStream(InputStream stream, PersonalStorageLoadOptions loadOptions)

Load PST from stream.

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe System.IO.Stream.
loadOptionsPersonalStorageLoadOptionsThe load options.

Returns: PersonalStorage - A PersonalStorage object that represents the current PST.

getCategories()

public final List<PstItemCategory> getCategories()

Retrieves a list of PST item categories, each containing a name and associated color.

Returns: java.util.List<com.aspose.email.PstItemCategory> - A List{PstItemCategory} containing all the available categories. The list will be non-empty if there is at least one item in the store that has the category assigned to it. If no categories are found or an error occurs, the list may be empty.

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getFolderById(byte[] entryId)

public final FolderInfo getFolderById(byte[] entryId)

Gets the personal folder from PST.

Parameters:

ParameterTypeDescription
entryIdbyte[]The Entry id.

Returns: FolderInfo - A FolderInfo object.

getFolderById(String entryIdString)

public final FolderInfo getFolderById(String entryIdString)

Gets the personal folder from PST.

Parameters:

ParameterTypeDescription
entryIdStringjava.lang.StringString representation of entry ID.

Returns: FolderInfo - A FolderInfo object.

getFormat()

public final int getFormat()

Gets the file format.

Value: FileFormat that specifies file format.


The .pst and .ost file formats are supported now.

Returns: int

getParentFolder(byte[] entryId)

public final FolderInfo getParentFolder(byte[] entryId)

Gets the parent folder of message.

Parameters:

ParameterTypeDescription
entryIdbyte[]Entry Id of message or folder.

Returns: FolderInfo - The parent folderFolderInfo of message.

getParentFolder(String entryIdString)

public final FolderInfo getParentFolder(String entryIdString)

Gets the parent folder of message.

Parameters:

ParameterTypeDescription
entryIdStringjava.lang.StringString representation of Entry Id of message or folder.

Returns: FolderInfo - The parent folderFolderInfo of message.

getPredefinedFolder(int defaultFolder)

public final FolderInfo getPredefinedFolder(int defaultFolder)

Gets the standard interpersonal message (IPM) folder from PST. Outlook can create a number of default folders, such as Outbox, Deleted Items, Sent Items etc.

Parameters:

ParameterTypeDescription
defaultFolderintThe value of StandardIpmFolder enumeration.

Returns: FolderInfo - A FolderInfo object that represents a standard IPM folder.

getRootFolder()

public final FolderInfo getRootFolder()

Gets the root folder of PST.

Value: FolderInfo that represents a root folder.

Returns: FolderInfo

getStore()

public final MessageStore getStore()

Gets the PST message store.

Value: The MessageStore which is the rough equivalent of the top of a Mailbox.

Returns: MessageStore

hashCode()

public native int hashCode()

Returns: int

isUnicode()

public final boolean isUnicode()

Gets a value indicating whether the PST file format is Unicode. There are two versions of the PST file format: Unicode and ANSI.

Returns: boolean

load(System.IO.Stream stream)

public final boolean load(System.IO.Stream stream)

Load PST from stream. This method is used when a PersonalStorage object is created using the constructor.

Parameters:

ParameterTypeDescription
streamcom.aspose.ms.System.IO.StreamThe System.IO.Stream.

Returns: boolean

load(InputStream stream)

public final boolean load(InputStream stream)

Load PST from stream. This method is used when a PersonalStorage object is created using the constructor.

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamThe System.IO.Stream.

Returns: boolean - ’true’ if the file has been loaded successfully and further traversal is possible; otherwise, false.

load(String fileName)

public final boolean load(String fileName)

Load PST from file. This method is used when a PersonalStorage object is created using the constructor.

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringThe name of .pst file.

Returns: boolean - ’true’ if the file has been loaded successfully and further traversal is possible; otherwise, false.

mergeWith(InputStream[] sourceStreams)

public final void mergeWith(InputStream[] sourceStreams)

Merges the pst storage with one or more other pst streams. Thus, the combined stream are sources.

Parameters:

ParameterTypeDescription
sourceStreamsjava.io.InputStream[]The source streams.

mergeWith(String[] sourceFileNames)

public final void mergeWith(String[] sourceFileNames)

Merges the pst storage with one or more other pst files. Thus, the combined files are sources.

Parameters:

ParameterTypeDescription
sourceFileNamesjava.lang.String[]The source file names.

moveItem(FolderInfo folder, FolderInfo newFolder)

public final void moveItem(FolderInfo folder, FolderInfo newFolder)

Moves a specified folder to a new parent folder within the current pst.

Parameters:

ParameterTypeDescription
folderFolderInfoThe folder to move.
newFolderFolderInfoThe new parent folder.

moveItem(MessageInfo message, FolderInfo newFolder)

public final void moveItem(MessageInfo message, FolderInfo newFolder)

Moves a specified message to a new folder within the current pst.

Parameters:

ParameterTypeDescription
messageMessageInfoThe message to move.
newFolderFolderInfoThe new folder for the message.

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

saveAs(OutputStream stream, int format)

public final void saveAs(OutputStream stream, int format)

Saves the current object to a specified file format in a stream.

Parameters:

ParameterTypeDescription
streamjava.io.OutputStreamThe stream to be saved.
formatintThe FileFormat is to be used.

It is used for the fast OST to PST conversion. The method doesn’t support conversion of OST created by MS Office 2013 and later versions. To convert an OST of later version, create a new PST and use the #mergeWith(Stream[]).mergeWith(Stream[]) method. |

saveAs(String fileName, int format)

public final void saveAs(String fileName, int format)

Saves the current object to a specified file format in a different file.

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringThe name of the file to be saved.
formatintThe FileFormat is to be used when saving a file.

It is used for the fast OST to PST conversion. The method doesn’t support conversion of OST created by MS Office 2013 and later versions. To convert an OST of later version, create a new PST and use the #mergeWith(String[]).mergeWith(String[]) method. |

saveMessageToFile(String entryId, String fileName)

public void saveMessageToFile(String entryId, String fileName)

saveMessageToFile.

Parameters:

ParameterTypeDescription
entryIdjava.lang.Stringa java.lang.String object.
fileNamejava.lang.Stringa java.lang.String object.

saveMessageToStream(String entryId, OutputStream stream)

public final void saveMessageToStream(String entryId, OutputStream stream)

Saves the message, with specified entryID, to a stream.

Parameters:

ParameterTypeDescription
entryIdjava.lang.StringThe entry id.
streamjava.io.OutputStreamThe stream for writing.

splitInto(System.Collections.Generic.IGenericList criteria, String path)

public final void splitInto(System.Collections.Generic.IGenericList<MailQuery> criteria, String path)

Splits the pst storage based on criteria.

Parameters:

ParameterTypeDescription
criteriacom.aspose.ms.System.Collections.Generic.IGenericList<com.aspose.email.MailQuery>The collection of MailQuery that represents criteria of pst splitting.
pathjava.lang.StringThe folder path where chunks will be created.

splitInto(System.Collections.Generic.IGenericList criteria, String partFileNamePrefix, String path)

public final void splitInto(System.Collections.Generic.IGenericList<MailQuery> criteria, String partFileNamePrefix, String path)

Splits the pst storage based on criteria.

Parameters:

ParameterTypeDescription
criteriacom.aspose.ms.System.Collections.Generic.IGenericList<com.aspose.email.MailQuery>The collection of MailQuery that represents criteria of pst splitting.
partFileNamePrefixjava.lang.StringThe prefix to be added to the filename of each part of pst. If provided, the prefix will be added to the beginning of each file name. If not provided (null or empty), the pst parts will be created without a prefix. The pst file names are produced using the following template: {prefix}_part{number}.pst - {prefix}: The filename prefix provided by the partFileNamePrefix parameter. If not provided, this part will be omitted. - {number}: The number of the chunk file.
pathjava.lang.StringThe folder path where chunks will be created.

splitInto(long chunkSize, String path)

public final void splitInto(long chunkSize, String path)

Splits the pst storage into less sized parts.

Parameters:

ParameterTypeDescription
chunkSizelongThe approximate size of a chunk in bytes.
pathjava.lang.StringThe folder path where chunks will be created.

splitInto(long chunkSize, String partFileNamePrefix, String path)

public final void splitInto(long chunkSize, String partFileNamePrefix, String path)

Splits the pst storage into less sized parts.

Parameters:

ParameterTypeDescription
chunkSizelongThe approximate size of a chunk in bytes.
partFileNamePrefixjava.lang.StringThe prefix to be added to the filename of each part of pst. If provided, the prefix will be added to the beginning of each file name. If not provided (null or empty), the pst parts will be created without a prefix.

The pst file names are produced using the following template: {prefix}_part{number}.pst - {prefix}: The filename prefix provided by the partFileNamePrefix parameter. If not provided, this part will be omitted. - {number}: The number of the chunk file. | | path | java.lang.String | The folder path where chunks will be created. |

toString()

public String toString()

Returns: java.lang.String

tryToGetFolderById(String entryIdString, FolderInfo[] folder)

public final boolean tryToGetFolderById(String entryIdString, FolderInfo[] folder)

Gets the folder associated with the specified entry ID.

Parameters:

ParameterTypeDescription
entryIdStringjava.lang.StringThe string that represented the entry ID.
folderFolderInfo[]When this method returns true, contains the FolderInfo object associated with the specified ID.

Returns: boolean - true if the folder is successfully found; otherwise, false.

tryToSaveMessage(String entryId, OutputStream stream)

public final SaveResult tryToSaveMessage(String entryId, OutputStream stream)

Saves the message, with specified entryID, to a stream.

Parameters:

ParameterTypeDescription
entryIdjava.lang.StringThe entry id.
streamjava.io.OutputStreamThe stream for writing.

Returns: SaveResult - The SaveResult that represents the result of item saving.

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int