FolderInfo

Inheritance: java.lang.Object

public final class FolderInfo

Represents information about personal folder in PST.

Constructors

ConstructorDescription
FolderInfo()Initializes a new instance of the FolderInfo class.

Fields

FieldDescription
ItemMovedOccurs when an item is moved to the another folder.
MessageAddedOccurs when a message is added to the current folder.

Methods

MethodDescription
addFile(String fileName, String messageClass)Adds a file into pst folder.
addMapiMessageItem(IMapiMessageItem item)Adds the IMapiMessageItem object into folder.
addMessage(MapiMessage message)Adds a new message into folder.
addMessages(Iterable messages)Provides message adding in a bulk mode.
addSubFolder(String name)Adds the new sub-folder.
addSubFolder(String name, boolean createHierarchy)Adds the new sub-folder.
addSubFolder(String name, FolderCreationOptions creationOptions)Adds a subfolder with the specified name to the current folder using the provided creation options.
addSubFolder(String name, String containerClass)Adds the new subfolder.
changeContainerClass(String containerClass)Changes the container class.
changeDisplayName(String newName)Changes the display name.
changeMessages(MapiPropertyCollection updatedProperties)Changes all messages in folder.
changeMessages(Iterable entryIdCollection, MapiPropertyCollection updatedProperties)Changes the messages in folder.
deleteChildItem(byte[] entryId)Deletes the item (folder or message) by it’s entryId.
deleteChildItems(Iterable entryIdCollection)Deletes the child messages.
enumerateFolders()Exposes the enumerator, which supports an iteration of subfolders in folder.
enumerateFolders(int kind)Exposes the enumerator, which supports an iteration of subfolders in folder.
enumerateMapiMessages()Exposes the enumerator, which supports an iteration of messages in folder.
enumerateMessageObjects()Exposes the enumerator, which supports an iteration of messages in folder.
enumerateMessages()Retrieves MessageInfo objects from the folder.
enumerateMessages(MailQuery mailQuery)Retrieves a collection of MessageInfo objects that match the specified query.
enumerateMessages(int kind)Retrieves a collection of MessageInfo objects of the specified kind.
enumerateMessages(int startIndex, int count)Retrieves a collection of MessageInfo objects starting from a specific index and limited to a specified count.
enumerateMessagesEntryId()Enumerates the entryID of messages.
equals(Object arg0)
getClass()
getContainerClass()Gets container class of the folder object.
getContentCount()Gets the total number of items in the folder.
getContentUnreadCount()Gets the number of unread items in the folder.
getContents()Get collection of messages.
Method is used to display brief message information MessageInfo like subject, sender, recipients.
getContents(boolean tryToReadCorruptedContents)Get collection of messages.
Method is used to display brief message information MessageInfo like subject, sender, recipients.
getContents(MailQuery query)Get collection of messages.
Method is used to display brief message information MessageInfo like subject, sender, recipients.
getContents(int kind)Get collection of messages.
Method is used to display brief message information MessageInfo like subject, sender, recipients.
getContents(int startIndex, int count)Gets the collection of messages.
Method is used to display brief message information MessageInfo like subject, sender, recipients.
getDisplayName()Gets the display name of folder.
getEntryId()Gets the entry ID.
getEntryIdString()Gets string representation of entry ID.
getLastModificationTime()Gets the last modification time.
getPredefinedType(boolean getForTopLevelParent)Gets the type of predefined folder.
getProperties()Gets the folder properties.
getSubFolder(String name)Get subfolder.
getSubFolder(String name, boolean ignoreCase)Gets the subfolder.
getSubFolder(String name, boolean ignoreCase, boolean handlePathSeparator)Retrieves a subfolder with the specified name from the current folder.
getSubFolders()Gets collection of subfolders.
getSubFolders(MailQuery query)Gets collection of subfolders.
getSubFolders(int kind)Gets collection of subfolders.
hasSubFolders()Gets a value indicating whether the Folder object has any subfolders.
hashCode()
mergeWith(FolderInfo sourceFolder)Merges the folder with the folder from another pst.
mergeWith(FolderInfo sourceFolder, boolean recursiveHandler)Merges the folder with the folder from another pst.
moveContents(FolderInfo newFolder)Moves the contents to a new folder.
moveSubfolders(FolderInfo newFolder)Moves the subfolders to a new parent folder.
notify()
notifyAll()
retrieveFullPath()Retrieves the full path of folder within the PST file.
toString()
updateMessage(String entryId, MapiMessageItemBase updatedMessage)Updates the message in folder.
wait()
wait(long arg0)
wait(long arg0, int arg1)

FolderInfo()

public FolderInfo()

Initializes a new instance of the FolderInfo class.

ItemMoved

public Event<ItemMovedEventHandler> ItemMoved

Occurs when an item is moved to the another folder.

MessageAdded

public final Event<MessageAddedEventHandler> MessageAdded

Occurs when a message is added to the current folder.

addFile(String fileName, String messageClass)

public final String addFile(String fileName, String messageClass)

Adds a file into pst folder.

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringThe name of file necessary to add.
messageClassjava.lang.StringThe message class.

Returns: java.lang.String - The string that represents the EntryId of the added message.

addMapiMessageItem(IMapiMessageItem item)

public final String addMapiMessageItem(IMapiMessageItem item)

Adds the IMapiMessageItem object into folder.

Parameters:

ParameterTypeDescription
itemIMapiMessageItemThe item necessary to add.

Returns: java.lang.String - The string that represents the EntryId of the added item.

addMessage(MapiMessage message)

public final String addMessage(MapiMessage message)

Adds a new message into folder.

Parameters:

ParameterTypeDescription
messageMapiMessageThe message necessary to add.

Returns: java.lang.String - The string that represents the EntryId of the added message.

addMessages(Iterable messages)

public final void addMessages(Iterable<MapiMessage> messages)

Provides message adding in a bulk mode.

Parameters:

ParameterTypeDescription
messagesjava.lang.Iterable<com.aspose.email.MapiMessage>An IEnumerator representing the enumerator, which supports iteration over a collection of MapiMessage.

addSubFolder(String name)

public final FolderInfo addSubFolder(String name)

Adds the new sub-folder.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name of sub-folder.

Returns: FolderInfo - The new sub-folder.

addSubFolder(String name, boolean createHierarchy)

public final FolderInfo addSubFolder(String name, boolean createHierarchy)

Adds the new sub-folder.

Parameters:

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

Returns: FolderInfo - The new sub-folder.

addSubFolder(String name, FolderCreationOptions creationOptions)

public final FolderInfo addSubFolder(String name, FolderCreationOptions creationOptions)

Adds a subfolder with the specified name to the current folder using the provided creation options.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name of the subfolder to add.
creationOptionsFolderCreationOptionsThe options for creating the subfolder.

The name parameter specifies the name of the subfolder to add. The creationOptions parameter allows customization of the subfolder creation behavior, such as specifying whether to create the hierarchy of parent folders and the container class of the new subfolder. If the subfolder with the specified name already exists, the behavior depends on the value of FolderCreationOptions.AllowNameCaseDifference (FolderCreationOptions.getAllowNameCaseDifference/FolderCreationOptions.setAllowNameCaseDifference(boolean)). If FolderCreationOptions.AllowNameCaseDifference (FolderCreationOptions.getAllowNameCaseDifference/FolderCreationOptions.setAllowNameCaseDifference(boolean)) is set to true , a difference in name casing will be allowed, and the subfolder will be added even if an existing folder with the same name but in a different case exists. If FolderCreationOptions.AllowNameCaseDifference (FolderCreationOptions.getAllowNameCaseDifference/FolderCreationOptions.setAllowNameCaseDifference(boolean)) is set to false , the comparison will be case-insensitive, and an InvalidOperationException will be thrown to indicate that a folder with the specified name already exists. The name may contain backslash (\) as the path separators (for example, “parent1\parent2\subfolder”). In this case if FolderCreationOptions.CreateHierarchy (FolderCreationOptions.getCreateHierarchy/FolderCreationOptions.setCreateHierarchy(boolean)) is set to true , the hierarchy of parent folders should be created. |

Returns: FolderInfo - The FolderInfo representing the added subfolder.

addSubFolder(String name, String containerClass)

public final FolderInfo addSubFolder(String name, String containerClass)

Adds the new subfolder.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name of subfolder.
containerClassjava.lang.StringContainer class of the sub-Folder object.

Returns: FolderInfo - The new subfolder.

changeContainerClass(String containerClass)

public final void changeContainerClass(String containerClass)

Changes the container class.

Parameters:

ParameterTypeDescription
containerClassjava.lang.StringContainer class of the of the folder object.

changeDisplayName(String newName)

public final void changeDisplayName(String newName)

Changes the display name.

Parameters:

ParameterTypeDescription
newNamejava.lang.StringA new name.

changeMessages(MapiPropertyCollection updatedProperties)

public final void changeMessages(MapiPropertyCollection updatedProperties)

Changes all messages in folder.

Parameters:

ParameterTypeDescription
updatedPropertiesMapiPropertyCollectionThe updated properties.

changeMessages(Iterable entryIdCollection, MapiPropertyCollection updatedProperties)

public final void changeMessages(Iterable<String> entryIdCollection, MapiPropertyCollection updatedProperties)

Changes the messages in folder.

Parameters:

ParameterTypeDescription
entryIdCollectionjava.lang.Iterable<java.lang.String>The entry identifier collection.
updatedPropertiesMapiPropertyCollectionThe updated properties.

deleteChildItem(byte[] entryId)

public final void deleteChildItem(byte[] entryId)

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

Parameters:

ParameterTypeDescription
entryIdbyte[]The entry id.

The item must be contained in a folder. |

deleteChildItems(Iterable entryIdCollection)

public final void deleteChildItems(Iterable<String> entryIdCollection)

Deletes the child messages.

Parameters:

ParameterTypeDescription
entryIdCollectionjava.lang.Iterable<java.lang.String>The entry id collection.

enumerateFolders()

public final System.Collections.Generic.IGenericEnumerable<FolderInfo> enumerateFolders()

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

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

enumerateFolders(int kind)

public final System.Collections.Generic.IGenericEnumerable<FolderInfo> enumerateFolders(int kind)

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

Parameters:

ParameterTypeDescription
kindintThe FolderKind that represents kind of folder.

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

enumerateMapiMessages()

public final System.Collections.Generic.IGenericEnumerable<MapiMessage> enumerateMapiMessages()

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

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

enumerateMessageObjects()

public final System.Collections.Generic.IGenericEnumerable<MessageObject> enumerateMessageObjects()

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

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

enumerateMessages()

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

Retrieves MessageInfo objects from the folder.

Returns: com.aspose.ms.System.Collections.Generic.IGenericEnumerable<com.aspose.email.MessageInfo> - An enumerable collection of all MessageInfo objects in the folder, excluding folder associated information (FAI) items.


Use this method to iterate through all messages in the folder without applying any filters or limits. Folder associated information (FAI) items, such as hidden metadata or configuration items, are not included in the returned collection.

enumerateMessages(MailQuery mailQuery)

public final System.Collections.Generic.IGenericEnumerable<MessageInfo> enumerateMessages(MailQuery mailQuery)

Retrieves a collection of MessageInfo objects that match the specified query.

Parameters:

ParameterTypeDescription
mailQueryMailQueryThe query criteria used to filter messages.

Use this method to retrieve messages that satisfy specific conditions, such as sender, subject, or date range, as defined by the mailQuery . |

Returns: com.aspose.ms.System.Collections.Generic.IGenericEnumerable<com.aspose.email.MessageInfo> - An enumerable collection of MessageInfo objects matching the query.

enumerateMessages(int kind)

public final System.Collections.Generic.IGenericEnumerable<MessageInfo> enumerateMessages(int kind)

Retrieves a collection of MessageInfo objects of the specified kind.

Parameters:

ParameterTypeDescription
kindintThe type of items to retrieve, such as normal messages or folder associated information items.

Use this method to filter items based on their type, such as distinguishing between messages or Folder Associated Information items. |

Returns: com.aspose.ms.System.Collections.Generic.IGenericEnumerable<com.aspose.email.MessageInfo> - An enumerable collection of MessageInfo objects of the specified kind.

enumerateMessages(int startIndex, int count)

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

Retrieves a collection of MessageInfo objects starting from a specific index and limited to a specified count.

Parameters:

ParameterTypeDescription
startIndexintThe zero-based index of the first message to retrieve.
countintThe maximum number of messages to retrieve. If set to -1 , retrieves all messages starting from the specified startIndex .

Use this method to fetch a subset of messages from the folder, which is useful for paginated retrieval or scenarios requiring controlled message processing. When count is set to -1 , all messages from startIndex to the end of the folder are returned. |

Returns: com.aspose.ms.System.Collections.Generic.IGenericEnumerable<com.aspose.email.MessageInfo> - An enumerable collection of MessageInfo objects starting at the specified index.

enumerateMessagesEntryId()

public final System.Collections.Generic.IGenericEnumerable<String> enumerateMessagesEntryId()

Enumerates the entryID of messages.

Returns: com.aspose.ms.System.Collections.Generic.IGenericEnumerable<java.lang.String> - System.Collections.Generic.IEnumerableltTgt , that represents an enumerator that iterates through entryID of messages in folder.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getContainerClass()

public final String getContainerClass()

Gets container class of the folder object.

Value: The container class.

Returns: java.lang.String

getContentCount()

public final int getContentCount()

Gets the total number of items in the folder.

Value: The content count.

Returns: int

getContentUnreadCount()

public final int getContentUnreadCount()

Gets the number of unread items in the folder.

Value: The content unread count.

Returns: int

getContents()

public final MessageInfoCollection getContents()

Get collection of messages. Method is used to display brief message information MessageInfo like subject, sender, recipients. In terms of performance, this is the most suitable option for obtaining primary information about messages. To extract complete message data, the PersonalStorage.extractMessage(MessageInfo) method is provided.

Returns: MessageInfoCollection - Collection of MessageInfo.

getContents(boolean tryToReadCorruptedContents)

public final MessageInfoCollection getContents(boolean tryToReadCorruptedContents)

Get collection of messages. Method is used to display brief message information MessageInfo like subject, sender, recipients. In terms of performance, this is the most suitable option for obtaining primary information about messages. To extract complete message data, the PersonalStorage.extractMessage(MessageInfo) method is provided.

Parameters:

ParameterTypeDescription
tryToReadCorruptedContentsbooleanIf the value of this parameter is true, the method will try to read the content even if the file is corrupted. This value can be used if the GetContents() method throws an exception about the file corruption. If the value of this parameter is false, the method works in the same way as GetContents() method without parameters.

Returns: MessageInfoCollection - Collection of MessageInfo.

getContents(MailQuery query)

public final MessageInfoCollection getContents(MailQuery query)

Get collection of messages. Method is used to display brief message information MessageInfo like subject, sender, recipients. In terms of performance, this is the most suitable option for obtaining primary information about messages. To extract complete message data, the PersonalStorage.extractMessage(MessageInfo) method is provided.

Parameters:

ParameterTypeDescription
queryMailQueryMailQuery that represents search query.

Returns: MessageInfoCollection - Collection of MessageInfo.

getContents(int kind)

public final MessageInfoCollection getContents(int kind)

Get collection of messages. Method is used to display brief message information MessageInfo like subject, sender, recipients. In terms of performance, this is the most suitable option for obtaining primary information about messages. To extract complete message data, the PersonalStorage.extractMessage(MessageInfo) method is provided.

Parameters:

ParameterTypeDescription
kindintThe message kind.

Returns: MessageInfoCollection - Collection of MessageInfo.

getContents(int startIndex, int count)

public final MessageInfoCollection getContents(int startIndex, int count)

Gets the collection of messages. Method is used to display brief message information MessageInfo like subject, sender, recipients. In terms of performance, this is the most suitable option for obtaining primary information about messages. To extract complete message data, the PersonalStorage.extractMessage(MessageInfo) method is provided.

Parameters:

ParameterTypeDescription
startIndexintThe start message index.
countintThe number of messages that will be retrieved.

If “count” param is less than 0 or more than remained message count then remained message count will be returned. |

Returns: MessageInfoCollection - Collection of MessageInfo.

getDisplayName()

public final String getDisplayName()

Gets the display name of folder.

Value: The display name.

Returns: java.lang.String

getEntryId()

public final byte[] getEntryId()

Gets the entry ID.

Value: The entry id.

Returns: byte[]

getEntryIdString()

public final String getEntryIdString()

Gets string representation of entry ID.

Value: The entry id string.

Returns: java.lang.String

getLastModificationTime()

public final Date getLastModificationTime()

Gets the last modification time.

Value: The last modification time. If the folder doesn’t have PR_LAST_MODIFICATION_TIME property, DateTime.MinValue is returned.

Returns: java.util.Date

getPredefinedType(boolean getForTopLevelParent)

public final int getPredefinedType(boolean getForTopLevelParent)

Gets the type of predefined folder.

Parameters:

ParameterTypeDescription
getForTopLevelParentbooleanIf true, returns the predefined type for the top-level parent folder. This determines whether the current folder is a subfolder of a predefined folder. If false, it returns the predefined type for the current folder.

Checks if the folder is predefined by returning the corresponding type. |

Returns: int - The StandardIpmFolder enum value. If the folder is not predefined, it returns StandardIpmFolder.Unspecified

getProperties()

public final MapiPropertyCollection getProperties()

Gets the folder properties.

Returns: MapiPropertyCollection

getSubFolder(String name)

public final FolderInfo getSubFolder(String name)

Get subfolder.

Parameters:

ParameterTypeDescription
namejava.lang.StringName of subfolder.

Returns: FolderInfo - A FolderInfo object.

getSubFolder(String name, boolean ignoreCase)

public final FolderInfo getSubFolder(String name, boolean ignoreCase)

Gets the subfolder.

Parameters:

ParameterTypeDescription
namejava.lang.StringName of subfolder.
ignoreCasebooleanIndicates that a search should ignore case sensitivity when matching the folder name.

Returns: FolderInfo - A FolderInfo object.

getSubFolder(String name, boolean ignoreCase, boolean handlePathSeparator)

public final FolderInfo getSubFolder(String name, boolean ignoreCase, boolean handlePathSeparator)

Retrieves a subfolder with the specified name from the current folder.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name of the subfolder to retrieve.
ignoreCasebooleanSpecifies whether to perform a case-insensitive search for folders with the given name.
handlePathSeparatorbooleanSpecifies whether the specified folder name should be treated as a path if it contains backslashes.

The name parameter specifies the name of the subfolder to retrieve. The ignoreCase parameter determines whether the search for the subfolder name should be case-sensitive or case-insensitive. If set to true , the search will be case-insensitive, otherwise, it will be case-sensitive. The handlePathSeparator parameter specifies whether the specified folder name should be treated as a path if it contains backslashes. If set to true , the method will interpret the folder name as a path, attempting to navigate to the subfolder using the path. If set to false , the method will treat the folder name as a simple name, searching for a subfolder with an exact name match. If the subfolder is found, the method returns the FolderInfo object representing the retrieved subfolder. If the subfolder is not found, the method returns null . |

Returns: FolderInfo - The FolderInfo representing the retrieved subfolder, or null if the subfolder is not found.

getSubFolders()

public final FolderInfoCollection getSubFolders()

Gets collection of subfolders.

Returns: FolderInfoCollection - The FolderInfo collection.

getSubFolders(MailQuery query)

public final FolderInfoCollection getSubFolders(MailQuery query)

Gets collection of subfolders.

Parameters:

ParameterTypeDescription
queryMailQueryMailQuery that represents search query.

Returns: FolderInfoCollection - The FolderInfo collection.

getSubFolders(int kind)

public final FolderInfoCollection getSubFolders(int kind)

Gets collection of subfolders.

Parameters:

ParameterTypeDescription
kindintThe FolderKind that represents kind of folder.

Returns: FolderInfoCollection - The FolderInfo collection.

hasSubFolders()

public final boolean hasSubFolders()

Gets a value indicating whether the Folder object has any subfolders.

Value: The has sub folders.

Returns: boolean

hashCode()

public native int hashCode()

Returns: int

mergeWith(FolderInfo sourceFolder)

public final void mergeWith(FolderInfo sourceFolder)

Merges the folder with the folder from another pst.

Parameters:

ParameterTypeDescription
sourceFolderFolderInfoThe source folder.

mergeWith(FolderInfo sourceFolder, boolean recursiveHandler)

public final void mergeWith(FolderInfo sourceFolder, boolean recursiveHandler)

Merges the folder with the folder from another pst. OnItemMoved event is called on both messages and directories.

Parameters:

ParameterTypeDescription
sourceFolderFolderInfoThe source folder.
recursiveHandlerbooleanIf true, OnItemMoved will be called on all messages, including messages in sub-directories, otherwise OnItemMoved will be called only for messages in the current directory.

moveContents(FolderInfo newFolder)

public final void moveContents(FolderInfo newFolder)

Moves the contents to a new folder.

Parameters:

ParameterTypeDescription
newFolderFolderInfoThe new folder.

moveSubfolders(FolderInfo newFolder)

public final void moveSubfolders(FolderInfo newFolder)

Moves the subfolders to a new parent folder.

Parameters:

ParameterTypeDescription
newFolderFolderInfoThe new parent folder.

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

retrieveFullPath()

public final String retrieveFullPath()

Retrieves the full path of folder within the PST file.

Returns: java.lang.String - The string that represents the full path.

toString()

public String toString()

Returns: java.lang.String

updateMessage(String entryId, MapiMessageItemBase updatedMessage)

public final void updateMessage(String entryId, MapiMessageItemBase updatedMessage)

Updates the message in folder.

Parameters:

ParameterTypeDescription
entryIdjava.lang.StringThe message entry identifier.
updatedMessageMapiMessageItemBaseThe updated message.

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