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.

I see the issue linked EMAILNET-40509 is closed. In previous topics, I will get a notification in my mailbox and said that the fix is involvded in the latest dll when the linked issue closed. It has been a long time since issue created. Could someone help to check whether this has been already fixed in latest version?


Please accept my apologies for your inconvenience. We will check this issue and send you the notification.

Your issue has been resolved and its fix is available in the latest version of Aspose.Email for .NET 22.3.

Thanks for the confirmation!