I use Aspose.Email for .NET v20.10.0 to create PersonalStorage, folders and items (MapiMessage, MapiTask, MapiCalendar…) But I found that the category properties I set for the item did not work.
category.png (11.6 KB)
My code is as follows:
static void testA()
{
string tempPath = Path.Combine(Desktop, "mypstFile", $"MyPSt{DateTime.Now.Ticks}.pst");
using (var ps = PersonalStorage.Create(tempPath, FileFormatVersion.Unicode))
{
var currentFolder = ps.CreatePredefinedFolder("testFolder", StandardIpmFolder.Inbox);
using (var item = new MapiMessage())
{
item.Subject = "test category2";
item.SenderName = "nat2";
item.SenderSmtpAddress = "nat2@abc.com";
item.SenderEmailAddress = "nat2@abc.com";
item.Recipients.Add("nat@abc.com", "nat", MapiRecipientType.MAPI_TO);
item.Body = "this is body!";
item.SetMessageFlags(MapiMessageFlags.MSGFLAG_READ);
item.Categories = "Blue Category".Split(';').ToArray();
currentFolder.AddMessage(item);
}
}
}
The version 18.4.0 was used before, and this version is able to set the categories attribute. But when I switched to the latest version, the problem appeared.
I have a small discovery: I think this problem is primarily in PersonalStorage Object.
I created a pst file using the v18.4.0 dll, and then used the v20.10.0 dll to load this file and add items, which is normal. Conversely, set category is still invalid