Cannot get PR_ENTRYID value extracted from OST file(Outlook 2010/2013)

Hi Team,

I cannot get PR_ENTRYID value of msg file that extracted from OST file(Outlook 2010/2013) by using ASPOSE.
This issue ocurres only on OST file.
We can get PR_ENTRYID value from the file which extracted from PST file(Outlook 2010/2013).
If there is any solution, please let me know.

ASPOSE Version:17.4.0.0

Code:

using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
// PSTファイルを読み込みます。
PersonalStorage pst = PersonalStorage.FromStream(fs);

   ExtractMsgFiles(outputDir, pst.RootFolder, pst, ref count, sw);

}

private static void ExtractMsgFiles(string outputDirPath,
    FolderInfo folderInfo, PersonalStorage pst, ref int count, System.IO.StreamWriter sw)
{

    Console.WriteLine("DisplayName : " + folderInfo.DisplayName);
    Console.WriteLine("Count : " + count);
    Console.WriteLine("ContentCount : " + folderInfo.ContentCount);

    foreach (MessageInfo messageInfo in folderInfo.GetContents())
    {
        MapiMessage message = pst.ExtractMessage(messageInfo);
        message.Save(Path.Combine(outputDirPath, count + ".msg"));
        count++;
    }
    if (folderInfo.HasSubFolders == true)
    {
        foreach (FolderInfo subfolderInfo in folderInfo.GetSubFolders())
        {
            ExtractMsgFiles(outputDirPath, subfolderInfo, pst, ref count, sw);
        }
    }
    sw.WriteLine("DisplayName : \t" + folderInfo.DisplayName + "\t Count: \t" + count + "\t ChildrenCount: \t" + folderInfo.ContentCount);
}

PR_ENTRYID:
image.png (60.8 KB)

Thanks & regards,
Yuichi Higuchi

@higu1030,

Please share your sample OST file with us for further investigation at our end. Also, Aspose.Email for .NET 17.4 is quite an older version now. Please try it with the latest version of the API i.e. Aspose.Email for .NET 18.2 at your end and let us know your feedback.

@kashif.iqbal

Thank you for your response.
This attachement is a sample file which file is created from Outlook2010.
Sorry, I could not attache OST2013 file because file size is too big to attach.
Outlook2010.zip (521.6 KB)

And, I have tried same verification by using latest dll (Aspose.Email for .NET 18.2).
But, I got same issue for both version.(Outlook 2010/2013)

Thanks & regards,
Yuichi Higuchi

@higu1030,

Thank you for sharing the sample OST file.

We are able to observe the issue with the sample OST file you have shared. However, we are unable to verify the presence of this property through any third party software. Could you please help us verify the presence of this property in the OST file messages? We’ll look into it for further investigation at our end.

@kashif.iqbal

Thank you for your response.

I use ‘OutlookSpy’ for checking property value.

http://www.dimastr.com/outspy/home.htm

You can check property value from ‘OutlookSpy tab → IMessage button’.

Outlookspy.PNG (29.1 KB)

@higu1030,

The PR_ENTRYID is maintained by MS Outlook and when message is extracted from the file, the information is no more available then. Please let us know if you have any further query in this regard.

@kashif.iqbal

Thank you for confirming.

Sorry, I would like to ask you about following code.

foreach (MessageInfo messageInfo in folderInfo.GetContents())
{
    MapiMessage message = pst.ExtractMessage(messageInfo);
    message.Save(Path.Combine(outputDirPath, count + ".msg"));
}

This code is msg file saving part.
In MessageInfo class , I can find EntryId proverty.

namespace Aspose.Email.Storage.Pst
{
    // 概要:
    //     Represents information about message in PST.
    public sealed class MessageInfo
    {
        // 概要:
        //     Initializes a new instance of the Aspose.Email.Storage.Pst.MessageInfo class.
        public MessageInfo();

        // 概要:
        //     Gets the CC: line.
        public string DisplayCC { get; }
        //
        // 概要:
        //     Gets the To: line.
        public string DisplayTo { get; }
        //
        // 概要:
        //     Gets the entry ID.
        public byte[] EntryId { get; }
        //
        // 概要:
        //     Gets string representation of entry ID.
        public string EntryIdString { get; }
        //
        // 概要:
        //     Gets the Importance.
        public MapiImportance Importance { get; }
        //
        // 概要:
        //     Gets the Message class.
        public string MessageClass { get; }
        //
        // 概要:
        //     Gets the MessageInfo properties.
        public MapiPropertyCollection Properties { get; }
        //
        // 概要:
        //     Gets the sender representative name.
        public string SenderRepresentativeName { get; }
        //
        // 概要:
        //     Gets the Sensitivity.
        public MapiSensitivity Sensitivity { get; }
        //
        // 概要:
        //     Gets the message subject.
        public string Subject { get; }
    }
}

But, after executing below code, message doesn’t have EntryId property.

MapiMessage message = pst.ExtractMessage(messageInfo);

Is there any way to keep EntryId property ?

@higu1030,

The EntryId String is not part of the message itself and is sort of linking between the message and its container. If you want to retain this property, you will have to write your own logic for the linkage of EntryId with Message out of PST.

@kashif.iqbal

Thank you for your response.

As your suggestion, We have written our logic.

Following code is working fine.

        foreach (MessageInfo messageInfo in folderInfo.GetContents())
        {
            MapiMessage message = pst.ExtractMessage(messageInfo);

            if (messageInfo.EntryId != null)
            {
                message.SetProperty(new MapiProperty(MapiPropertyTag.PR_ENTRYID, messageInfo.EntryId));
            }
            message.Save(Path.Combine(outputDirPath, count + ".msg"));
            count++;
        }

Thanks & regards,
Yuichi Higuchi

@higu1030,

We regret the confusion caused in this regard. Our understand of your requirement was to set the property directly while exporting messages from the PST. Yes, you can set it like this manually using the above code sample you have shared. Please feel free to write to us if you have any further query in this regard.