Working with MapiTask in PST

Adding MapiTask to PST

Create New PST, Add Sub-folders and Messages showed how to create a PST file and add a subfolder to it. With Aspose.Email you can add MapiTask to the Tasks subfolder of a PST file that you have created or loaded.

Below are the steps to add MapiTask to a PST:

  1. Create a MapiTask object.
  2. Set the MapiTask properties using constructor and different methods.
  3. Create a PST using the PersonalStorage.create() method.
  4. Create a pre-defined folder (Tasks) at the root of the PST file by accessing the Root folder and then calling the addMapiMessageItem() method.

The code snippet below shows how to create a MapiTask and then add it to the Tasks folder of a newly created PST file.