We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cannot convert an item to MapiTask if task will renew after complete


I met a issue when using the latest Aspose.Email to read a task item in a PST file. The code is built in C#.
Sample code:
var pstStore = PersonalStorage.FromFile(@“C:\Renewtask.pst”);
var folders = pstStore.RootFolder.GetSubFolders();
var tasksFolderInfo = folders.Where(f => f.DisplayName == “Tasks”).FirstOrDefault();
var tasksFolder = pstStore.GetFolderById(tasksFolderInfo.EntryId);
var items = tasksFolder.GetContents();
foreach(var i in items)
var thisObject = pstStore.ExtractMessage(i.EntryId);
var thisTask = thisObject.ToMapiMessageItem() as MapiTask;
//exception occurred in this line

This is the sample PST in zip.
RenewTask.zip (14.5 KB)

In the code, I want to get the MapiTask object so that I can get some properties for this task. But an exception occurred when “as”. The sample data has been uploaded, the issue seems related to the recurrence. The task is very simple, but it will automatically generate a new one when the previous one is complete.
Could someone take a look on this issue?



We have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as EMAILNET-40509. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.