Free Support Forum - aspose.com

Problems while getting MapiNamedProperty from message

Hello,

I would like to ask some help about getting MapiNamedProperty from a message.
Here is my code:

MapiPropertyCollection properties = message.getNamedProperties();
for (int k = 0; k < properties.size(); k++)
{
	MapiNamedProperty prop = (MapiNamedProperty) properties.get_Item(k);
	int type = prop.getDataType();
	if (type == MapiPropertyType.PT_UNICODE)
	{
		// ...
	}
}

The “prop” class is getting a null value, and I don’t understand why.

Thanks

Hi,

I successfully got the properties using the following code bellow:

MapiPropertyCollection properties = message.getNamedProperties();
IGenericCollection col = properties.getValues();
for (Iterator i = col.iterator(); i.hasNext(); )
{
	MapiNamedProperty prop = (MapiNamedProperty) i.next();
	
	if (prop.getNameId().equals("Test-property"))
	{
		System.out.println(prop.getString());
	}
}

You can close this post, it’s solved.

@kelberuc

It’s good to know things are fine on your end. Please share with us if there is any issue incurring on your end.