How to Set Priority or Importance on MAPITask object

Hi,


I downloaded an evaluation of Aspose.Email and played around with the MAPITask. I can set almost every property like “Subject”, “Body”, “Reminder” and “Status” just like Outlook. However, looks like there is no property I can set for “Priority” or “Importance” on this MAPITask class. Is there anyway I can set the “Priority” or “Importance” just like Outlook value for “High”, “Low” or “Normal”?

This is my current codes.

Task tsk = new Task();
MapiTask task = new MapiTask();
task.Subject = strSubject;
task.Body = strNotes;
task.StartDate = dtStartDate;
task.DueDate = dtDueDate;
task.DateCompleted = dtCompletedDate;
task.PercentComplete = 100;
task.ReminderSet = bReminderSet;
task.ReminderTime = dtReminderDate;
task.Save(msgSavePath, TaskSaveFormat.Msg);

Thanks.

Hi Loi,


Thank you for contacting Aspose support team.

This feature can be achieved by setting the property using MapiMessage in conjunction with MapiTask as shown in the following sample code.

//Task tsk = new Task();
MapiTask task = new MapiTask();
task.Subject = “strSubject”;
task.Body = “strNotes”;
task.StartDate = new DateTime();
task.DueDate = new DateTime();
task.DateCompleted = new DateTime();
task.PercentComplete = 100;
task.ReminderSet = true;
task.ReminderTime = new DateTime();
MemoryStream memStr = new MemoryStream();
task.Save(memStr, TaskSaveFormat.Msg);
MapiMessage mapi1 = MapiMessage.FromStream(memStr);
Int64 iMapiProperty = 2;//0:LOW, 1:NORMAL, 2:HIGH
MapiProperty prop = new MapiProperty(MapiPropertyTag.PR_IMPORTANCE, BitConverter.GetBytes(iMapiProperty));
mapi1.SetProperty(prop);
mapi1.Save(“TestMapiTask2.msg”);

Please feel free to write us back if you have any other query in this regard.

Thank you Kashif! It works great! Thank you again.

Hi Loi,


We are glad to know that your issue is resolved. Please feel free to write us back if you have any other query related to Aspose.Email.