The trial version prohibits the extraction/deletion of more than 50 messages from a PST. The problem discussed in your previous post in not a known issue nor an evaluation limitation. Although the problem could be sample specific, so I would request you to please share your sample PST for our review. We will quickly investigate the issue on our end, and if found to be valid, we will definitely log it in our defect database for correction purposes.
I am currently testing the v2.0.0 Beta for publishing. Upon receiving your file, I have tested it against v2.0.0 and below mentioned sample code. The latest version throws exception (NullReference) when try to access MapiAttachment.DisplayName property. The exception has been logged as NETWORKNET-33369 in our defect database. We will soon look into the problem and provide the fix at earliest.
C#
var pst = PersonalStorage.FromFile(“outlook.pst”);
var contents = pst.RootFolder.GetSubFolder(“Bandeja de entrada”).GetContents(); foreach (var messageInfo in contents)
{
var message = pst.ExtractMessage(messageInfo); if (message.Attachments.Count > 0)
{ foreach(MapiAttachment attachment in message.Attachments)
{
Console.WriteLine(attachment.DisplayName.ToString());
Console.WriteLine(attachment.Extension);
}
}
}
Ok, thank you very much. Another question, is it possible to set a flag in any mail for “extract” only new mails (I mean, no processed mails) from pst?
I am afraid there are no means available to filter the processed mails from a PST. You have to implement your own custom filtration method for your need.
Thanks for being patient for the resolution of your reference issue NEWORKNET-33369.
After further investigation, we found that the DisplayName and Extension properties returning null tells about PR_DISPLAY_NAME and
PR_ATTACH_EXTENSION properties being absent in the MapiAttachment, as the values of
these properties are taken from
corresponding MAPI properties. It also refers to the rest string properties
that take their values from MAPI properties.
Aspose.Email provides a number of MapiPropertyTag to get the details about these properties. In order to get the details about these property tags, please refer to the following functions in product offline as well as online documentation.
MapiPropertyTag.PR_DISPLAY_NAME
MapiPropertyTag.
PR_ATTACH_EXTENSION
If the pst item contains EML as attachment to a MSG, you can load the MSG file using MailMessage and then get it in a MapiMessage object. You can then access various property tags of the attachment using the attachment object of the MapiMessage. Here is a sample code for your reference:
How can I liberate the use of pst ? I get an error when I try to open outlook with a pst.
Can you please elaborate your requirements as what you intend to do with the PST? Also, please provide more details about the error that you are getting when opening the PST with Outlook. We will analyze the information and assist you further as soon as possible.
I would like to share with you that it’s not possible to open/read a PST file at the same time when it is opened by another application. This is the default behavior of PST file and setting the flag to false doesn’t affect this behavior. The “false” flag only enables the file to be loaded in read-only mode so that no changes can be made to it.
If I use pst file in read mode, why I can't open it with Outlook at the same time? I mean, read mode shouldn't take pst file exclusively. In my app I need to extract info from pst while Outlook is open. .PST can't permit this?
Following are the two methods used for opening PST.
1. public static PersonalStorage FromFile(string fileName);
2. public static PersonalStorage FromFile(string fileName,bool writable);
Here the first one supports writing to PST by default. Whereas second function gives control to user for declaring it to be writable or not. So its just a flag for deciding whether Aspose.Email will modify the PST or not.
However this flag does not effect the behavior of outlook for opening PST. Outlook does not open a PST if its already opened by any application in any mode. So its not possible to open PST in outlook while its opened by any other program.
You are welcome. Please feel free to contact us if you have any additional query or feel any difficulty. We will try our best to assist you further as soon as possible.