public final class FolderInfo extends Object
Represents information about personal folder in PST.
| Modifier and Type | Field and Description |
|---|---|
Event<ItemMovedEventHandler> |
ItemMoved
Occurs when an item is moved to the another folder.
|
Event<MessageAddedEventHandler> |
MessageAdded
Occurs when a message is added to the current folder.
|
| Constructor and Description |
|---|
FolderInfo()
Initializes a new instance of the
FolderInfo class. |
| Modifier and Type | Method and Description |
|---|---|
String |
addFile(String fileName,
String messageClass)
Adds a file into pst folder.
|
String |
addMapiMessageItem(IMapiMessageItem item)
Adds the IMapiMessageItem object into folder.
|
String |
addMessage(MapiMessage message)
Adds a new message into folder.
|
void |
addMessages(Iterable<MapiMessage> messages)
Provides message adding in a bulk mode.
|
FolderInfo |
addSubFolder(String name)
Adds the new sub-folder.
|
FolderInfo |
addSubFolder(String name,
boolean createHierarchy)
Adds the new sub-folder.
|
FolderInfo |
addSubFolder(String name,
FolderCreationOptions creationOptions)
Adds a subfolder with the specified name to the current folder using the provided creation options.
|
FolderInfo |
addSubFolder(String name,
String containerClass)
Adds the new subfolder.
|
void |
changeContainerClass(String containerClass)
Changes the container class.
|
void |
changeDisplayName(String newName)
Changes the display name.
|
void |
changeMessages(Iterable<String> entryIdCollection,
MapiPropertyCollection updatedProperties)
Changes the messages in folder.
|
void |
changeMessages(MapiPropertyCollection updatedProperties)
Changes all messages in folder.
|
void |
deleteChildItem(byte[] entryId)
Deletes the item (folder or message) by it's entryId.
|
void |
deleteChildItems(Iterable<String> entryIdCollection)
Deletes the child messages.
|
IGenericEnumerable<FolderInfo> |
enumerateFolders()
Exposes the enumerator, which supports an iteration of subfolders in folder.
|
IGenericEnumerable<FolderInfo> |
enumerateFolders(int kind)
Exposes the enumerator, which supports an iteration of subfolders in folder.
|
IGenericEnumerable<MapiMessage> |
enumerateMapiMessages()
Exposes the enumerator, which supports an iteration of messages in folder.
|
IGenericEnumerable<MessageObject> |
enumerateMessageObjects()
Exposes the enumerator, which supports an iteration of messages in folder.
|
IGenericEnumerable<MessageInfo> |
enumerateMessages()
Exposes the enumerator, which supports an iteration of messages in folder.
|
IGenericEnumerable<String> |
enumerateMessagesEntryId()
Enumerates the entryID of messages.
|
String |
getContainerClass()
Gets container class of the folder object.
|
int |
getContentCount()
Gets the total number of items in the folder.
|
MessageInfoCollection |
getContents()
Get collection of messages.
Method is used to display brief message information MessageInfo like subject, sender, recipients. |
MessageInfoCollection |
getContents(boolean tryToReadCorruptedContents)
Get collection of messages.
Method is used to display brief message information MessageInfo like subject, sender, recipients. |
MessageInfoCollection |
getContents(int kind)
Get collection of messages.
Method is used to display brief message information MessageInfo like subject, sender, recipients. |
MessageInfoCollection |
getContents(int startIndex,
int count)
Gets the collection of messages.
Method is used to display brief message information MessageInfo like subject, sender, recipients. |
MessageInfoCollection |
getContents(MailQuery query)
Get collection of messages.
Method is used to display brief message information MessageInfo like subject, sender, recipients. |
int |
getContentUnreadCount()
Gets the number of unread items in the folder.
|
String |
getDisplayName()
Gets the display name of folder.
|
byte[] |
getEntryId()
Gets the entry ID.
|
String |
getEntryIdString()
Gets string representation of entry ID.
|
Date |
getLastModificationTime()
Gets the last modification time.
|
int |
getPredefinedType(boolean getForTopLevelParent)
Gets the type of predefined folder.
|
MapiPropertyCollection |
getProperties()
Gets the folder properties.
|
FolderInfo |
getSubFolder(String name)
Get subfolder.
|
FolderInfo |
getSubFolder(String name,
boolean ignoreCase)
Gets the subfolder.
|
FolderInfo |
getSubFolder(String name,
boolean ignoreCase,
boolean handlePathSeparator)
Retrieves a subfolder with the specified name from the current folder.
|
FolderInfoCollection |
getSubFolders()
Gets collection of subfolders.
|
FolderInfoCollection |
getSubFolders(int kind)
Gets collection of subfolders.
|
FolderInfoCollection |
getSubFolders(MailQuery query)
Gets collection of subfolders.
|
boolean |
hasSubFolders()
Gets a value indicating whether the Folder object has any subfolders.
|
void |
mergeWith(FolderInfo sourceFolder)
Merges the folder with the folder from another pst.
|
void |
mergeWith(FolderInfo sourceFolder,
boolean recursiveHandler)
Merges the folder with the folder from another pst.
|
void |
moveContents(FolderInfo newFolder)
Moves the contents to a new folder.
|
void |
moveSubfolders(FolderInfo newFolder)
Moves the subfolders to a new parent folder.
|
String |
retrieveFullPath()
Retrieves the full path of folder within the PST file.
|
void |
updateMessage(String entryId,
MapiMessageItemBase updatedMessage)
Updates the message in folder.
|
public final Event<MessageAddedEventHandler> MessageAdded
Occurs when a message is added to the current folder.
public Event<ItemMovedEventHandler> ItemMoved
Occurs when an item is moved to the another folder.
public FolderInfo()
Initializes a new instance of the FolderInfo class.
public final String getDisplayName()
Gets the display name of folder.
Value: The display name.public final int getContentCount()
Gets the total number of items in the folder.
Value: The content count.public final int getContentUnreadCount()
Gets the number of unread items in the folder.
Value: The content unread count.public final boolean hasSubFolders()
Gets a value indicating whether the Folder object has any subfolders.
Value: The has sub folders.public final String getContainerClass()
Gets container class of the folder object.
Value: The container class.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.public final byte[] getEntryId()
Gets the entry ID.
Value: The entry id.public final String getEntryIdString()
Gets string representation of entry ID.
Value: The entry id string.public final MapiPropertyCollection getProperties()
Gets the folder properties.
public final FolderInfo getSubFolder(String name)
Get subfolder.
name - Name of subfolder.public final FolderInfo getSubFolder(String name, boolean ignoreCase)
Gets the subfolder.
name - Name of subfolder.ignoreCase - Indicates that a search should ignore case sensitivity when matching the folder name.public final FolderInfo getSubFolder(String name, boolean ignoreCase, boolean handlePathSeparator)
Retrieves a subfolder with the specified name from the current folder.
name - The name of the subfolder to retrieve.ignoreCase - Specifies whether to perform a case-insensitive search for folders with the given name.handlePathSeparator - Specifies whether the specified folder name should be treated as a path if it contains backslashes.
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.
FolderInfo representing the retrieved subfolder, or null if the subfolder is not found.public final FolderInfoCollection getSubFolders()
Gets collection of subfolders.
public final FolderInfoCollection getSubFolders(int kind)
Gets collection of subfolders.
kind - The FolderKind that represents kind of folder.public final FolderInfoCollection getSubFolders(MailQuery query)
Gets collection of subfolders.
query - MailQuery that represents search query.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.
tryToReadCorruptedContents - If 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.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.
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.
kind - The message kind.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.
query - MailQuery that represents search query.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.
startIndex - The start message index.count - The number of messages that will be retrieved.
ArgumentOutOfRangeException - throws, if startIndex less than 0.ArgumentOutOfRangeException - throws, if startIndex more or equal to total message count that folder contains.public final IGenericEnumerable<FolderInfo> enumerateFolders()
Exposes the enumerator, which supports an iteration of subfolders in folder.
System.Collections.Generic.IEnumerableltTgt,
that represents an enumerator that iterates through a subfolders in folder.public final IGenericEnumerable<FolderInfo> enumerateFolders(int kind)
Exposes the enumerator, which supports an iteration of subfolders in folder.
kind - The FolderKind that represents kind of folder.System.Collections.Generic.IEnumerableltTgt,
that represents an enumerator that iterates through a subfolders in folder.public final IGenericEnumerable<MessageInfo> enumerateMessages()
Exposes the enumerator, which supports an iteration of messages in folder.
System.Collections.Generic.IEnumerableltTgt,
that represents an enumerator that iterates through a messages in folder.public final IGenericEnumerable<MessageObject> enumerateMessageObjects()
Exposes the enumerator, which supports an iteration of messages in folder.
System.Collections.Generic.IEnumerableltTgt,
that represents an enumerator that iterates through a messages in folder.public final IGenericEnumerable<MapiMessage> enumerateMapiMessages()
Exposes the enumerator, which supports an iteration of messages in folder.
System.Collections.Generic.IEnumerableltTgt,
that represents an enumerator that iterates through a messages in folder.public final IGenericEnumerable<String> enumerateMessagesEntryId()
Enumerates the entryID of messages.
System.Collections.Generic.IEnumerableltTgt,
that represents an enumerator that iterates through entryID of messages in folder.public final String retrieveFullPath()
Retrieves the full path of folder within the PST file.
public final FolderInfo addSubFolder(String name, boolean createHierarchy)
Adds the new sub-folder.
name - The name of sub-folder.createHierarchy - if set to true, it is possible to create a folder hierarchy using string notation.
Backslash ('\') is used as path separator.NotImplementedException - throws, if a PST file version is ANSI.ArgumentNullException - throws, if a sub-folder name is null or empty.InvalidOperationException - throws, if a PST is open for reading only.public final FolderInfo addSubFolder(String name)
Adds the new sub-folder.
name - The name of sub-folder.NotImplementedException - throws, if a PST file version is ANSI.ArgumentNullException - throws, if a sub-folder name is null or empty.InvalidOperationException - throws, if a PST is open for reading only.public final FolderInfo addSubFolder(String name, String containerClass)
Adds the new subfolder.
name - The name of subfolder.containerClass - Container class of the sub-Folder object.NotImplementedException - throws, if a PST file version is ANSI.ArgumentNullException - throws, if a subfolder name is null or empty.InvalidOperationException - throws, if a PST is open for reading only.InvalidOperationException - throws, if a folder with same name already exists.
The comparison will be case-insensitive, and the folder creation operation will consider
folders with the same name but different casing as duplicates.public final FolderInfo addSubFolder(String name, FolderCreationOptions creationOptions)
Adds a subfolder with the specified name to the current folder using the provided creation options.
name - The name of the subfolder to add.creationOptions - The options for creating the subfolder.
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.
FolderInfo representing the added subfolder.NotImplementedException - throws, if a PST file version is ANSI.ArgumentNullException - throws, if a subfolder name is null or empty.InvalidOperationException - throws, if a PST is open for reading only.InvalidOperationException - throws, if a folder with same name already exists.
Whether folders have the same name will depend on the FolderCreationOptions.AllowNameCaseDifference(FolderCreationOptions.getAllowNameCaseDifference()/FolderCreationOptions.setAllowNameCaseDifference(boolean)) parameter.public final String addMessage(MapiMessage message)
Adds a new message into folder.
message - The message necessary to add.NotImplementedException - throws, if a PST file version is ANSI.ArgumentNullException - throws, if a message to add is null.InvalidOperationException - throws, if a PST is open for reading only.public final String addFile(String fileName, String messageClass)
Adds a file into pst folder.
fileName - The name of file necessary to add.messageClass - The message class.NotImplementedException - throws, if a PST file version is ANSI.ArgumentNullException - throws, if a name of file to add is null or empty.InvalidOperationException - throws, if a PST is open for reading only.public final String addMapiMessageItem(IMapiMessageItem item)
Adds the IMapiMessageItem object into folder.
item - The item necessary to add.NotImplementedException - throws, if a PST file version is ANSI.ArgumentNullException - throws, if an item to add is null.InvalidOperationException - throws, if a PST is open for reading only.NotSupportedException - Thrown when MessageClass doesn't belong to IPM.Note, IPM.StickyNote,
IPM.Contact, IPM.Activity, IPM.Appointment, IPM.Schedule.meeting, IPM.Task.InvalidOperationException - Thrown when MessageClass doesn't correspond to the folder's ContainerClass.public final void addMessages(Iterable<MapiMessage> messages)
Provides message adding in a bulk mode.
messages - An IEnumerator
representing the enumerator, which supports iteration over a collection of MapiMessage.NotImplementedException - Thrown when attempting to edit the ANSI file version.public final void moveContents(FolderInfo newFolder)
Moves the contents to a new folder.
newFolder - The new folder.NotImplementedException - Thrown when attempting to edit the ANSI file version.ArgumentNullException - Thrown when new folder is null.public final void moveSubfolders(FolderInfo newFolder)
Moves the subfolders to a new parent folder.
newFolder - The new parent folder.NotImplementedException - Thrown when attempting to edit the ANSI file version.ArgumentNullException - Thrown when new folder is null.public final void mergeWith(FolderInfo sourceFolder)
Merges the folder with the folder from another pst.
sourceFolder - The source folder.InvalidOperationException - Throws when the source folder is located in the same pst.NotImplementedException - Thrown when attempting to edit the ANSI file version.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.
sourceFolder - The source folder.recursiveHandler - If 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.InvalidOperationException - Throws when the source folder is located in the same pst.NotImplementedException - Thrown when attempting to edit the ANSI file version.public final void deleteChildItem(byte[] entryId)
Deletes the item (folder or message) by it's entryId.
entryId - The entry id.
ArgumentNullException - throws, if entryId is null.InvalidOperationException - throws, if the item doesn't belong to the folder
or the item can't be deleted
or entryID has the incorrect value.InvalidOperationException - throws, if a PST is open for reading only.NotImplementedException - Thrown when attempting to edit the ANSI file version.public final void deleteChildItems(Iterable<String> entryIdCollection)
Deletes the child messages.
entryIdCollection - The entry id collection.InvalidOperationException - The PST is open for reading only.
or
The item, to be deleted, doesn't belong to this folder.
or
The search folder cannot be deleted.
or
The \Deleted Items\ folder cannot be deleted.
or
The entryId is incorrect.ArgumentNullException - entryId;The entryId cannot be null.NotImplementedException - Thrown when attempting to edit the ANSI file version.public final void updateMessage(String entryId, MapiMessageItemBase updatedMessage)
Updates the message in folder.
entryId - The message entry identifier.updatedMessage - The updated message.NotImplementedException - The ANSI file version editing is not implemented.InvalidOperationException - The PST is open for reading only.
or
The entryId is incorrect.ArgumentNullException - entryId; The entry id cannot be null or empty.
or
updatedMessage; The message cannot be null.public final void changeMessages(Iterable<String> entryIdCollection, MapiPropertyCollection updatedProperties)
Changes the messages in folder.
entryIdCollection - The entry identifier collection.updatedProperties - The updated properties.NotImplementedException - The ANSI file version editing is not implemented.InvalidOperationException - The PST is open for reading only.
or
The entryId is incorrect.ArgumentNullException - entryIdCollection;The collection of entry ids cannot be null.
or
updatedProperties;The collection of properties cannot be null.public final void changeMessages(MapiPropertyCollection updatedProperties)
Changes all messages in folder.
updatedProperties - The updated properties.NotImplementedException - The ANSI file version editing is not implemented.InvalidOperationException - The PST is open for reading only.
or
The entryId is incorrect.ArgumentNullException - entryIdCollection;The collection of entry ids cannot be null.
or
updatedProperties;The collection of properties cannot be null.public final void changeContainerClass(String containerClass)
Changes the container class.
containerClass - Container class of the of the folder object.InvalidOperationException - throws, if a PST is open for reading only.NotImplementedException - throws, if a PST file version is ANSI.public final void changeDisplayName(String newName)
Changes the display name.
newName - A new name.InvalidOperationException - throws, if a PST is open for reading only.NotImplementedException - throws, if a PST file version is ANSI.public final int getPredefinedType(boolean getForTopLevelParent)
Gets the type of predefined folder.
getForTopLevelParent - If 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.
StandardIpmFolder enum value.
If the folder is not predefined, it returns StandardIpmFolder.UnspecifiedCopyright (c) 2008-2024 Aspose Pty Ltd. All Rights Reserved.