Microsoft Personal Folders File (PST) Metadata
In addition to the default metadata set, you can extract Messaging Application Programming Interface (MAPI) properties from a PST file. These properties describe elements (subject, sender, recipient, and so on) of Outlook items within the PST file. Since the properties are stored in the PST file itself, they can be retrieved before the contents of the PST are extracted. This enables you to determine whether an Outlook item should be extracted based on a subfile's attributes. MAPI properties are also stored for Outlook attachments that are not mail messages (such as an attached Microsoft Word document or Lotus 1-2-3 file).
MAPI Properties
Each MAPI property is identified by a property tag, which is a constant that contains the property type and a unique identifier. For example, the property that indicates whether a message has attachments has the following components:
Property | PR_HASATTACH
|
Identifier | 0x0E1B
|
Property type | PT_BOOLEAN (000B ) |
Property tag | 0x0E1B000B
|
The Microsoft MAPI documentation on the Microsoft Developer Network website lists all available MAPI properties, their tags, and types.
You can retrieve any MAPI property that is of one of the MAPI property types listed below:
PT_I2
|
PT_DOUBLE
|
PT_STRING8
|
PT_I4
|
PT_FLOAT
|
PT_TSTRING
|
PT_BINARY
|
PT_LONG
|
PT_SYSTIME
|
PT_BOOLEAN
|
PT_SHORT
|
PT_UNICODE
|
NOTE: Properties with a PT_TSTRING
type have the property type recompiled to either a Unicode string (PT_UNICODE
) or to an ANSI string (PT_STRING8
) depending on the operating system's character set. To retrieve the Unicode property, pass in the Unicode version of the tag. For example, the property tag for PR_SUBJECT
is either 0x0037001E
for an ANSI string, or 0x0037001F
for a Unicode string.
Extract PST-Specific Metadata
In the call to extract subfile metadata, you can pass either the MAPI tag number (such as 0x0070001e
) or one of the constants in the Filter class (such as KVPR_SUBJECT
). These constants are a subset of MAPI properties and use a KeyView naming convention. For example, the property PR_CONVERSATION_TOPIC
is defined as KVPR_CONVERSATION_TOPIC
. If the property you want to retrieve is not defined as a constant in the Filter class, you must pass the MAPI tag number.
To extract specific MAPI properties from a PST file, use the method ExtractGetSubFileMetadata(int extractFileId, int metadataID, string metaDataName)
and pass the tag number or constant to metaNameArray
.
For example, the following code extracts the MAPI properties PR_SUBJECT
and PR_ALTERNATE_RECIPIENT
:
int[] metaIDs = new int[2] { Filter.Constant.MAPIConstant.KVPR_SUBJECT, 0x3A010102 } ; string[] metaDataName = null ; m_objFilter.SetMetaConfig(); ExtractSubFileMetadata metadata; metadata = m_objFilter.ExtractGetSubFileMetadata(extContextId, metaIDs, metaDataName);