com.aspose.email

com.aspose.email

Class PersonalStorage

All Implemented Interfaces:
com.aspose.email.ms.System.IDisposable
public class PersonalStorage
extends Object
implements com.aspose.email.ms.System.IDisposable

Represents Personal Storage Table (.pst) file.

Constructor Summary
 
Method Summary
boolean
canWrite()
Gets a value indicating whether the current pst supports writing.
void
changeDisplayName(String newName)
Changes the pst display name.
create(OutputStream stream, intversion)
create(String fileName, intversion)
Creates the new PST file with the specified file name.
createPredefinedFolder(String name, intdefaultFolder)
Creates the standard interpersonal message (IPM) folder.
void
dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
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, longtag)
Gets the specified property of item, without extract the item fully.
fromFile(String fileName)
Load PST from file.
fromFile(String fileName, booleanwritable)
Load PST from file.
fromStream(InputStream stream, booleanwritable)
getDisplayName()
Gets the display Name of PST.
getFolderById(byte[]entryId)
Gets the personal folder from PST.
getFolderById(String entryIdString)
Gets the personal folder from PST.
int
getFormat()
Gets the file format.
getMessageStoreProperties()
Gets the MAPI properties of message store object.
getPredefinedFolder(intdefaultFolder)
Gets the standard interpersonal message (IPM) folder from PST.
getRootFolder()
Gets the root folder of PST.
boolean
isUnicode()
Gets a value indicating whether the PST file format is Unicode.
void
saveMessageToFile(String entryId, String fileName)
void
 
Methods inherited from class java.lang.Object
 

    • Constructor Detail

      • PersonalStorage

        public PersonalStorage()
    • Method Detail

      • getRootFolder

        public FolderInfo getRootFolder()

        Gets the root folder of PST.

        Value: FolderInfo that represents a root folder.

      • getDisplayName

        public String getDisplayName()

        Gets the display Name of PST.

        Value: The string that represents display name.

      • getFormat

        public int getFormat()

        Gets the file format.

        Value: FileFormat that specifies file format.

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

      • canWrite

        public boolean canWrite()

        Gets a value indicating whether the current pst supports writing.

      • getMessageStoreProperties

        public MapiPropertyCollection getMessageStoreProperties()

        Gets the MAPI properties of message store object. The message store contains the top-level PST settings and metadata that are required to access and manage the PST contents.

      • isUnicode

        public 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.

      • fromFile

        public static PersonalStorage fromFile(String fileName)

        Load PST from file.

        Parameters:
        fileName - Name of .pst file.

        By default, the pst will support writing.

        Returns:
        A PersonalStorage object that represents the current PST.
      • fromFile

        public static PersonalStorage fromFile(String fileName,
                                               boolean writable)

        Load PST from file.

        Parameters:
        fileName - Name of .pst file.
        writable - if set to true then the the pst file will support writing, otherwise it will be opened in read-only mode.
        Returns:
        A PersonalStorage object that represents the current PST.
      • create

        public static PersonalStorage create(String fileName,
                                             int version)

        Creates the new PST file with the specified file name.

        Parameters:
        fileName - The full name of the file.
        version - The PST file version.

        Note, only Unicode file version creation is supported now.

        Returns:
        A PersonalStorage object that represents the new PST.
        Throws:
        com.aspose.email.ms.System.NotImplementedException - throws if ANSI file version is created
        com.aspose.email.ms.System.IllegalArgumentException - throws if file name is null or empty
      • extractMessage

        public MapiMessage extractMessage(MessageInfo messageInfo)

        Get the message from PST.

        Parameters:
        messageInfo - A MessageInfo object that represents information about message.
        Returns:
        A MapiMessage object.
      • extractMessage

        public MapiMessage extractMessage(byte[] entryId)

        Get the message from PST.

        Parameters:
        entryId - EntryId of message.
        Returns:
        A MapiMessage object.
      • extractMessage

        public MapiMessage extractMessage(String entryId)

        Get the message from PST.

        Parameters:
        entryId - String representation of EntryId.
        Returns:
        A MapiMessage object.
      • saveMessageToStream

        public void saveMessageToStream(String entryId,
                                        OutputStream stream)
      • saveMessageToFile

        public void saveMessageToFile(String entryId,
                                      String fileName)
      • createPredefinedFolder

        public FolderInfo createPredefinedFolder(String name,
                                                 int defaultFolder)

        Creates the standard interpersonal message (IPM) folder.

        Parameters:
        name - The name of folder.
        defaultFolder - The value of StandardIpmFolder enumeration.
        Returns:
        A FolderInfo object that represents a standard IPM folder.
      • getPredefinedFolder

        public 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:
        defaultFolder - The value of StandardIpmFolder enumeration.
        Returns:
        A FolderInfo object that represents a standard IPM folder.
      • getFolderById

        public FolderInfo getFolderById(byte[] entryId)

        Gets the personal folder from PST.

        Parameters:
        entryId - The Entry id.
        Returns:
        A FolderInfo object.
      • getFolderById

        public FolderInfo getFolderById(String entryIdString)

        Gets the personal folder from PST.

        Parameters:
        entryIdString - String representation of entry ID.
        Returns:
        A FolderInfo object.
      • extractProperty

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

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

        Parameters:
        entryId - The entry id of item.
        tag - The property tag.

        If a property is not found, null is returned.

        Returns:
        The MapiProperty.
      • changeDisplayName

        public void changeDisplayName(String newName)

        Changes the pst display name.

        Parameters:
        newName - The new display name of message store.
      • dispose

        public void dispose()

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

        Specified by:
        dispose in interface com.aspose.email.ms.System.IDisposable