com.aspose.email
Class PersonalStorage

java.lang.Object
  extended by com.aspose.email.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
PersonalStorage()
           
 
Method Summary
 boolean canWrite()
           Gets a value indicating whether the current pst supports writing.
 void changeDisplayName(String newName)
           Changes the pst display name.
static PersonalStorage create(OutputStream stream, int version)
           
static PersonalStorage create(String fileName, int version)
           Creates the new PST file with the specified file name.
 FolderInfo createPredefinedFolder(String name, int defaultFolder)
           Creates the standard interpersonal message (IPM) folder.
 void dispose()
           Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 MapiMessage extractMessage(byte[] entryId)
           Get the message from PST.
 MapiMessage extractMessage(MessageInfo messageInfo)
           Get the message from PST.
 MapiMessage extractMessage(String entryId)
           Get the message from PST.
 MapiProperty extractProperty(byte[] entryId, long tag)
           Gets the specified property of item, without extract the item fully.
static PersonalStorage fromFile(String fileName)
           Load PST from file.
static PersonalStorage fromFile(String fileName, boolean writable)
           Load PST from file.
static PersonalStorage fromStream(InputStream stream)
           
static PersonalStorage fromStream(InputStream stream, boolean writable)
           
 String getDisplayName()
           Gets the display Name of PST.
 FolderInfo getFolderById(byte[] entryId)
           Gets the personal folder from PST.
 FolderInfo getFolderById(String entryIdString)
           Gets the personal folder from PST.
 int getFormat()
           Gets the file format.
 MapiPropertyCollection getMessageStoreProperties()
           Gets the MAPI properties of message store object.
 FolderInfo getPredefinedFolder(int defaultFolder)
           Gets the standard interpersonal message (IPM) folder from PST.
 FolderInfo 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 saveMessageToStream(String entryId, OutputStream stream)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.

fromStream

public static PersonalStorage fromStream(InputStream stream,
                                         boolean writable)

fromStream

public static PersonalStorage fromStream(InputStream stream)

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

create

public static PersonalStorage create(OutputStream stream,
                                     int version)

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


Copyright (c) 2008-2013 Aspose Pty Ltd. All Rights Reserved.