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

Free Support Forum - aspose.com

Setting MAPI custom properties

Hello Support Team,

I’ve a licence for an old Aspose version, and have this problem. So before buying the licence for latest version, I’ve tested with latest version using a test projet and nuget package, and have the same behavior.

I’m trying to put some custom property in a MSG file, then open this MSG (using Outlook) and check if Outlook can see this property. I make this check using Outlook Spy, and it doesn’t see the property.
Could you tell me what’s wrong with my code ?

My Real Use case is :

  • Downloading MSG file from our server
  • Using Aspose, updating standard and custom properties, then save the file
  • Open the email (=> Outlook)
  • When the user send the mail, an add-in intercept the send and check the custom property ==> No custom property is visible.

My Test use case (full code in attachment)

  • Using aspose, open and update the email subject, add a custom property “TestingCustomProp” with value “123456”, then save the email
  • Open the email (=> Outlook)
  • Check the subject and custom property
    • For the subject, the change is correctly done
    • For the custom prop, using Outlook spy this custom prop is not visible

Could you tell me what’s wrong ?
I set the custom property using this code:

static void setProp(MapiMessage mail, string name, string value)
    var property = new MapiProperty(

    mail.AddCustomProperty(property, name);          

I’ve put my complete test project + email sample in attachment
AsposeTests.zip (18.0 KB)

Thank you for your help,


We have evaluated the sample provided by you. Please modify your code a bit to get the expected result. Sample code snippet is given below. Resultant MSG file is attached for your reference.


Aspose.Email.Mapi.MapiMessage mapiMsg = 
        var storage = mapiMsg.NamedPropertyMapping;

        long ltag = mapiMsg.NamedPropertyMapping.GetNextAvailablePropertyId(Aspose.Email.Mapi.MapiPropertyType.PT_UNICODE);

        var stringProperty = new Aspose.Email.Mapi.MapiProperty(ltag, 
                                                                Encoding.Unicode.GetBytes("this is a test property unicode string value"));
        storage.AddNamedPropertyMapping(stringProperty, "testProperty", new Guid());


        Aspose.Email.Mapi.MapiMessage mapiMsg_Saved = Aspose.Email.Mapi.MapiMessage.FromFile(@"Test_complex_with_prop.msg");
        var propertyValue = mapiMsg_Saved.GetPropertyString(ltag);

test_complex_with_prop.zip (15.1 KB)