Named Properties with Existing Tag Value

I am trying to recreate a Named Property. I already have the tag value given to me, so I’m not using the getNextAvailablePropertyId method of the MapiNamedPropertyMappingStorage object. Instead I have code like the test below. Unfortunately the code below does not report any values, is there something I’m doing wrong with Named Properties? I have found the property in the in another collection. Why is that? What am I doing wrong with Named Properties?

Thanks,
//C



private void testCreation() {

//Construct the empty mapi message from a mail message. This will ensure
// proper initialization of the message
MapiMessage mapi = MapiMessage.fromMailMessage(new MailMessage());

//Get the storage, created it required
MapiNamedPropertyMappingStorage namedStorage = mapi.getNamedPropertyMapping();
if(namedStorage == null) {
namedStorage = new MapiNamedPropertyMappingStorage();
}

long tag = 2217148446L;
long type = MapiType.PT_STRING8;
long nameId = 2217148446L;
String name = “2217148446”; //Just the long as a string for lookup
String uuid = “33EBA41F-7AA8-422E-BE7B-79E1A98E54B3”;
byte[] data = “TEST-STRING”.getBytes();

//Create the mapi property
MapiProperty mProp = new MapiProperty(tag, data);

//Set the property
mapi.setProperty(mProp);

UUID guid = UUID.fromString(uuid);
namedStorage.addNamedPropertyMapping(mProp, nameId, guid);
for(MapiNamedProperty property : (Iterable)mapi.getNamedProperties().getValues()) {

if(name.equals(property.getNameId())) {
System.out.println(property.getGuid().toString() + “|” + property.getTag() + “|” + property.getString());
}
}

Hi Christopher,

Thank you for writing to Aspose support team. We are currently working over your query and request you to spare us a little time in this regard. We’ll soon share our results with you here for assisting you further.

Kashif,

I’m slowly learning more about Mapi and it appears that you cannot use an existing tag when you want to create a Named Property. I suspect that the API is enforcing that and this is my problem. However, additional Java doc at the class header level would be helpful. It seems as though the tag values must be relative to the container they are being put into. So reusing a tag value from one container into another isn’t valid.

If you have additional information about the Mapi protocol, may I suggest you link to it on your support site. That may help give people additional insight into the hows and why the API works the way it does.

I suppose you can close out my issue above, sorry to cause you guys busy work.

//C

Hi Christopher,


We were also able to observe the same and it seems that this is expected API behavior. For further explanation on this, I have requested our development team to provide details so that these can be mentioned in our documentation as well. If there is any other update in this regard, we’ll update you here via this thread.