Working with MapiTask in PST
Contents
[
Hide
]
Adding MapiTask to PST
Create a New PST File and Add Subfolders 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:
- Create a MapiTask object.
- Set the MapiTask properties using constructor and different methods.
- Create a PST using the PersonalStorage.Create() method.
- 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 following code snippet shows you how to create a MapiTask and then add it to the tasks folder of a newly created PST file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For complete examples and data files, please go to https://github.com/aspose-email/aspose-email-python-dotnet | |
task = MapiTask("To Do", "Just click and type to add new task", dt.datetime.now(), dt.datetime.today() + timedelta(days=3)) | |
task.percent_complete = 20 | |
task.estimated_effort = 2000 | |
task.actual_effort = 20 | |
task.history = MapiTaskHistory.ASSIGNED | |
task.last_update = dt.datetime.now() | |
task.users.owner = "Darius" | |
task.users.last_assigner = "Harkness" | |
task.users.last_delegate = "Harkness"; | |
task.users.ownership = MapiTaskOwnership.ASSIGNERS_COPY | |
personalStorage = PersonalStorage.create(dataDir + "AddMapiTaskToPST_out.pst", FileFormatVersion.UNICODE) | |
tasksFolder = personalStorage.create_predefined_folder("Tasks", StandardIpmFolder.TASKS) | |
tasksFolder.add_mapi_message_item(task) | |
personalStorage.dispose() |