Extract PST Metadata via C++
Build your own C++ apps to add, edit, remove or extract metadata from PST files using server-side APIs.
How to Get PST Metadata Using C++
In order to extract PST metadata, we’ll use
API which is a feature-rich, powerful and easy to use document metadata extraction API for C++ platform. You can download its latest version directly, just open
package manager, search for Aspose.Email.Cpp and install. You may also use the following command from the Package Manager Console.
Command
PM> Install-Package Aspose.Email.Cpp
Steps to Extract Metadata of PST via C++
Get the type of the message while using GetProperties which in turn allows getting all metadata information via a simple loop.
- Load the PST file via MapiMessage::FromFile
- Get properties collection using get_Properties()
- Get the respective property using idx_get
System Requirements
Aspose.Email for C++ supports on all major platforms and Operating Systems. Please make sure that you have the following prerequisites.
- Microsoft Windows or a compatible OS with C++ Runtime Environment for Windows 32 bit, Windows 64 bit and Linux 64 bit.
- Aspose.Email for C++ DLL referenced in your project.
Extract Metadata of PST - C++
// Load from file
System::SharedPtr<MapiMessage> pst = MapiMessage::FromFile(dataDir + L"message.pst");
System::String subject;
// Access the MapiPropertyTag.PR_SUBJECT property
System::SharedPtr<MapiProperty> prop = pst->get_Properties()->idx_get(MapiPropertyTag::PR_SUBJECT);
// If the property is not found, check the MapiPropertyTag.PR_SUBJECT_W (which is a // Unicode peer of the MapiPropertyTag.PR_SUBJECT)
if (prop == nullptr){
prop = pst->get_Properties()->idx_get(MapiPropertyTag::PR_SUBJECT_W);
}
// Cannot found
if (prop == nullptr){
System::Console::WriteLine(L"No property found!");
return;
}
// Get the property data as string
subject = prop->GetString();
System::Console::WriteLine(System::String(L"Subject:") + subject);
// Read internet code page property
prop = msg->get_Properties()->idx_get(MapiPropertyTag::PR_INTERNET_CPID);
if (prop != nullptr){
System::Console::WriteLine(System::String(L"CodePage:") + prop->GetLong());
}
About Aspose.Email for C++ API
Aspose.Email is a Microsoft Outlook and Thunderbird formats parsing solution. One can easily create, manipulate, convert email and storage formats such as MSG, EMLX, EML and MHT. Handling of email attachments, customization of message headers and implementation of different network protocols like POP3, IMAP & SMTP to send & receive emails is much easier. Its a standalone API and does not require Microsoft Outlook or any other software installation.Extract Metadata of PST via Online App
View & edit Metadata to PST documents by using our Live Demos with following benefits.
PST What is PST File Format
Files with .PST extension represent Outlook Personal Storage Files (also called Personal Storage Table) that store variety of user information. User information is stored in folders of different types that include emails, calendar items, notes, contacts, and several other file formats. PST files are used for archiving emailing data offline that can be later loaded and viewed in various applications.
Read More