Marking items in PST in place with Custom Property

Hi,

we’re processing items in PST files and we want to track the ones we already processed via setting a custom property on them like this:

private static void MarkMessages(FolderInfo folder)
{
var messageInfoCollection = folder.EnumerateMapiMessages();
<span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">"Marking messages"</span>);
<span style="color:blue;">var</span> guid = <span style="color:#2b91af;">Guid</span>.NewGuid();  <span style="color:green;">// NewGuid for testing</span>

<span style="color:blue;">foreach</span> (<span style="color:blue;">var</span> messageInfo <span style="color:blue;">in</span> messageInfoCollection)
{
    <span style="color:blue;">var</span> nextPropId = messageInfo.NamedPropertyMapping.GetNextAvailablePropertyId(<span style="color:#2b91af;">MapiPropertyType</span>.PT_LONG);
    <span style="color:blue;">var</span> mapiProp = <span style="color:blue;">new</span> <span style="color:#2b91af;">MapiProperty</span>(nextPropId, <span style="color:#2b91af;">BitConverter</span>.GetBytes(123));  <span style="color:green;">// correct item id be be used</span>
    messageInfo.NamedPropertyMapping.AddNamedPropertyMapping(mapiProp, <span style="color:#a31515;">"ITEM_ID"</span>, guid);

    messageInfo.SetProperty(mapiProp);
}

}

Unfortunately, it doesn’t seem like there is a way to persist this message item back to PST without export / import the item into the folder.

Is there any possibility to mark a single item (or save a modified message) in place in the PST?

Best regards,
Michal

Hi Michal,

Thank you for writing to Aspose Support team.

You are right in saying that there is no other way to make this change persistent by exporting and importing it again to the PST folder. While extracting a message, a copy of the message is retrieved from the PST folder and, thus, making changes won’t be reflected in-place in the message.

Hi Kashif,

thanks for getting back to me. I thought so, as there is no parameter-less Save method on the MapiMessage (only to stream or file). I guess we’ll just use another approach then.

Best regards,
Michal

Hi Michal,


Thank you for providing feedback. Please feel free to write us back for any other query related to Aspose.Email.

Hi Michal,

We further discussed any such possibility with our product team and the requirement will be further analyzed in detail for any such possible implementation. The issue has been logged as EMAILNET-34970 and we’ll notify you here once there is some information available in this regard.

The issues you have found earlier (filed as EMAILNET-34970) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.