PST with loose files not messages

I cannot figure out how to save a word document our from a PST that is NOT attached to an email. Other API have a MAPI document type but I cannot find it in ASPOSE. I have an example PST if needed.

@dfplive,

Such a file in PST is identified via its message class as IPM.Document. For reading files, you may fetch file as MapiMessage and then retrieve the attachment using the following sample code:

Sample Code

PersonalStorage pst = PersonalStorage.FromFile(path + "test.pst");

FolderInfo folder = pst.RootFolder.GetSubFolder("Files");

MessageInfoCollection coll = folder.GetContents();

foreach(MessageInfo info in coll)
{
     Console.WriteLine("info.MessageClass = " + info.MessageClass);

     if(info.MessageClass == "IPM.Document")
     {


     Console.WriteLine("Its Word doc");

     MapiMessage mapi = pst.ExtractMessage(info);
     
     if (mapi.Attachments.Count > 0)
          mapi.Attachments[0].Save(path +  mapi.Attachments[0].FileName);
}

thanks I went another direction with similar results

check the messageClass to see if it can be converted to a IMapiMessageItem if not then assume it is a file and use getPst().saveMessageToFile

IMapiMessageItem list is “IPM.Note”, “IPM.StickyNote”, “IPM.Contact”, “IPM.Activity”, “IPM.Appointment”, “IPM.Schedule.meeting”, “IPM.Task”

@dfplive,

Thank you for sharing your sample code. It will definitely add to the knowledge of other users regarding overall API usage.