PersonalStorageContainer Class
Provides a container for Outlook's Personal Storage.
Inheritance Hierarchy
SystemObject
  GroupDocs.Parser.ContainersContainer
    GroupDocs.Parser.ContainersPersonalStorageContainer

Namespace: GroupDocs.Parser.Containers
Assembly: GroupDocs.Parser (in GroupDocs.Parser.dll) Version: 19.5
Syntax
public sealed class PersonalStorageContainer : Container

The PersonalStorageContainer type exposes the following members.

Constructors
  NameDescription
Public methodPersonalStorageContainer(Stream)
Initializes a new instance of the PersonalStorageContainer class.
Public methodPersonalStorageContainer(String)
Initializes a new instance of the PersonalStorageContainer class.
Properties
  NameDescription
Public propertyEncoding
Gets or sets an encoding for the container.
(Inherited from Container.)
Public propertyEntities
Gets a collection of the container's entities.
(Inherited from Container.)
Public propertyMediaType
Gets or sets a media type for the container.
(Inherited from Container.)
Methods
  NameDescription
Public methodDispose
Releases the unmanaged resources used by the container.
(Inherited from Container.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Public methodOpenEntityStream
Opens a stream with the content of the container's entity.
(Inherited from Container.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Examples

Enumerate all messages in the file:

C#
// Create a container for Outlook's Personal Storage
using (var container = new PersonalStorageContainer(stream))
{
  // Iterate items
  for(int i = 0; i<container.Entities.Count; i++)
  {
    Console.WriteLine("Name: " + container.Entities[i].Name); // the ID of the entity
    Console.WriteLine("Path: " + container.Entities[i].Path.ToString()); // path in the container
    Console.WriteLine("Media type: " + container.Entities[i].MediaType); // media type (for example: APPLICATION/VND.MS-OUTLOOK)
    Console.WriteLine("Subject: " + container.Entities[i][MetadataNames.Subject]); // email's subject
    Console.WriteLine("" + container.Entities[i][MetadataNames.EmailFrom]); // email's sender (field 'from')
    Console.WriteLine("" + container.Entities[i][MetadataNames.EmailTo]); // email's receiver (field 'to')
  }
}

Read the concrete message:

C#
// Create a container for Outlook's Personal Storage
using (var container = new PersonalStorageContainer(stream))
{
  // Create an extractor for the email
  using (EmailTextExtractor extractor = new EmailTextExtractor(container.Entities[messageIndex].OpenStream()))
  {
    // Extract a text from the email
    Console.WriteLine(extractor == null ? "document isn't supported" : extractor.ExtractAll());
  }
}
See Also