PPTX DOCX XLSX PDF ODP
Aspose.Email  for Java
OST

Extract OST Metadata via Java

Build your own Java apps to add, edit, remove or extract metadata from OST files using server-side APIs.

How to Extract OST Metadata Using Java

In order to get OST file metadata, we’ll use

Aspose.Email for Java

API which is a feature-rich, powerful and easy to use metadata API for Java platform. You can download its latest version directly from

Maven

and install it within your Maven-based project by adding the following configurations to the pom.xml.

<h3>Repository</h3>

<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>https://repository.aspose.com/repo/</url>
</repository>
<h3>Dependency</h3>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-email</artifactId>
<version>version of aspose-email API</version>
<classifier>jdk17</classifier>
</dependency>

Steps to Extract Metadata of OST via Java

Get the type of the message while using GetProperties which in turn allows getting all metadata information via a simple loop.

  • Load the OST file using MapiMessage.fromFile
  • Get properties collection using getProperties()
  • Access the relevant property like Subject using get_Item()

System Requirements

Aspose.Email for Java supports on all major platforms and Operating Systems. Please make sure that you have the following prerequisites.

  • Microsoft Windows or a compatible OS with Java Runtime Environment for JSP/JSF Application and Desktop Applications.
  • Get latest version of Aspose.Email for Java directly from Maven .
 

Extract Metadata of OST - Java


MapiMessage outlookMessageFile = MapiMessage.fromFile(dataDir + "messageMapi.ost");

//Get the MapiProperties collection
MapiPropertyCollection coll = outlookMessageFile.getProperties();

//Access the MapiPropertyTag.PR_SUBJECT property
MapiProperty prop = (MapiProperty) coll.get_Item((Object) MapiPropertyTag.PR_SUBJECT);

//If the MapiProperty is not found, check the MapiProperty.PR_SUBJECT_W
//which is a unicode peer of MapiPropertyTag.PR_SUBJECT
if (prop == null) {
	prop = (MapiProperty) coll.get_Item(MapiPropertyTag.PR_SUBJECT_W);
}

//If it cannot be found
if (prop == null) {
	System.out.println("Mapi property could not be found.");
} else {
	//Get the property data as string
	String strSubject = prop.getString();
	System.out.println("Subject: " + strSubject);
}

//Read internet code page property
prop = (MapiProperty) coll.get_Item(MapiPropertyTag.PR_INTERNET_CPID);
if (prop != null) {
	System.out.println("Code page: " + prop.getLong());
}  
 
  • About Aspose.Email for Java 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 OST via Online App

    View & edit Metadata to OST documents by using our Live Demos with following benefits.

      No need to download or setup anything
      No need to write any code
      Just upload your OST file & edit document properties
      Instantly get the download link for the resultant file

    OST What is OST File Format

    OST or Offline Storage Files represent user's mailbox data in offline mode on local machine upon registration with Exchange Server using Microsoft Outlook. It is automatically created on the first use of Microsoft Outlook upon connectivity with server. Once the file is created, the data is synchronized with the email server so that it is available offline as well in case of disconnectivity from email server. OST files can user mailbox items such as emails, contacts, calendar information, notes, tasks and other similar data. Users can create emails and other data items in OST file even in the absence of connection to the server, but these will not be synchronized with the server. Once the connection is established, the local file is synchronized with the server again so that both the server and the local copy are at the same level of information.

    Read More

    Other Supported Metadata Formats

    Using Java, One can also manipulate metadata of many other formats including

    EML (Outlook Email Messages)
    MBOX (Electronic Mail Messages)
    MSG (Outlook & Exchange Format)
    PST (Outlook Personal Storage Files)