Keywords 0x8020101F

Hi Alexandre,


We regret any inconvenience caused to you and thanks for providing more information.

I am also able to observe the issue here and have forwarded all the information to our development team for further analysis. We will write back here on forum as soon as some feedback is given by the developers.

This issue is logged in our bug reporting system as NETWORKNET-33476.

Hi Alexandre,

After further analyzing this issue, we have found that you need to determine whether the message is in Unicode or ASCII format and then specify the proper data type for a multivalued property. Thus, the code snippet must be modified as following:

long propertyId = msg.IsStoreUnicodeOk() ?
    storage.GetNextAvailablePropertyId(MapiPropertyType.PT_MV_UNICODE):
    storage.GetNextAvailablePropertyId(MapiPropertyType.PT_MV_STRING8);

This will specify the proper data type for a multivalued property.

Hi Kashif,


I tried your suggestion and it works great!

Thanks for your help,
Alexandre

Hi Alexandre,


You are welcome and please feel free to contact us in case you have any additional query. We will be glad to assist you further.

Hi,


I discovered that the code above does not work when the source email already have one or more categorie set.
In that case, the new categories are not added.

Here is my full code:
Aspose.Email.Outlook.MapiMessage message = Aspose.Email.Outlook.MapiMessage.FromFile(@“test3.msg”);

MapiNamedPropertyMappingStorage storage = message.NamedPropertyMapping;

Guid PS_PUBLIC_STRINGS = new Guid(“00020329-0000-0000-C000-000000000046”);

long propertyId = message.IsStoreUnicodeOk() ? storage.GetNextAvailablePropertyId(MapiPropertyType.PT_MV_UNICODE) : storage.GetNextAvailablePropertyId(MapiPropertyType.PT_MV_STRING8);

string[] keywords = {“test1”, “test2”, “test3”, “test4” };

MapiProperty mapiProperty = new MapiProperty(propertyId, keywords);

message.SetProperty(mapiProperty);

storage.AddNamedPropertyMapping(mapiProperty, “Keywords”, PS_PUBLIC_STRINGS);

message.Save(@“output.msg”);


Any idea why?

Thank you,
Alexandre

Hi Alexandre,


Please accept our apologies for late reply.

We are analyzing the issue and will share our findings soon. Your patience is highly appreciated in this regard.


Hi Alexandre,


I have tried to reproduce the issue here but am afraid to inform that I could not succeed.

I used a sample MSG file and then executed your code where a named property “Keywords” was added with 4 values and this updated message was saved to a file “output.msg”.

Next time I changed your code such that input MSG file was changed to “output.msg”. Now here this input file had already a named property “Keywords”. After execution of this code, again this named property is saved in the file “output.msg”.

I also changed the named property name to “Keywords1” and assigned different values to it. After execution I was able to observe all the previous named properties along with new ones.

I added little code to check the results and this complete code is attached here for your reference. Please test it and send us your feedback whether is this the same test as mentioned by you. If this scenario is different from that of yours, please send more information to reproduce the issue.

Aspose.Email.Outlook.MapiMessage message = Aspose.Email.Outlook.MapiMessage.FromFile(“EMAIL_428169\output.msg”);
MapiNamedPropertyMappingStorage storage = message.NamedPropertyMapping;
Guid PS_PUBLIC_STRINGS = new Guid(“00020329-0000-0000-C000-000000000046”);
long propertyId = message.IsStoreUnicodeOk() ? storage.GetNextAvailablePropertyId(MapiPropertyType.PT_MV_UNICODE) : storage.GetNextAvailablePropertyId(MapiPropertyType.PT_MV_STRING8);
string[] keywords = { “test9”, “test10”, “test11”, “test12” };
MapiProperty mapiProperty = new MapiProperty(propertyId, keywords);
message.SetProperty(mapiProperty);
storage.AddNamedPropertyMapping(mapiProperty, “Keywords1”, PS_PUBLIC_STRINGS);
message.Save(“EMAIL_428169\output.msg”);
var message1 = MapiMessage.FromFile(“EMAIL_428169\output.msg”);
foreach (MapiNamedProperty namedProperty in message.NamedProperties.Values)
{
if (namedProperty.NameId == “Keywords”)
{
Console.WriteLine(“Name:” + namedProperty.NameId);
string propertyValue = namedProperty.GetString();
Console.WriteLine(“Named Property :” + propertyValue);
}

if (namedProperty.NameId == “Keywords1”)
{
Console.WriteLine(“Name:” + namedProperty.NameId);
string propertyValue = namedProperty.GetString();
Console.WriteLine(“Named Property :” + propertyValue);
}
}


Following is the sample output:
Name:Keywords
Named Property :test1,test2,test3,test4
Name:Keywords
Named Property :test1,test2,test3,test4
Name:Keywords1
Named Property :test9,test10,test11,test12
Name:Keywords1
Named Property :test9,test10,test11,test12
Name:Keywords
Named Property :test5,test6,test7,test8
Name:Keywords
Named Property :test1,test2,test3,test4

Your cooperation is highly appreciated.