We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Do aspose.email.outlook product has Delete function

I have requirement to delete Unwanted message without using outlook based on message ID .or whatever ID e.g entry ID.is it possible using your product .

please mail me as quick as possible.

This message was posted using Page2Forum from Aspose.Email.Outlook - Aspose.Email for .NET

Hi there,

Thanks for your inquiry.

I will move your request to the Aspose.Email forum so the team there can assist you further. They will reply to your asap.



Thank you for considering Aspose.

Please check the below linked technical article on how to delete messages from exchange server,

In case you have further questions or comments, please feel free to write back.

I am again getting it clear that i want to delete message from PST file.My requirement is that I have PST file i want to delete message by passing Message ID programmatically using C sharp .NET.



Thank you for the clarification.

I am afraid, at the moment Aspose.Email for .NET does not support deletion of messages from PST file.

We will discuss this feature with development team and if feasible we will add it to our road map.

Sorry for your inconvenience.

Thanks Expert for your Quick response


We already have this feature on our road map. With the release of Aspose.Email for .NET v1.2.0, DeleteChildItem(byte[] entryId) method will be available in FolderInfo class. Using which will enable you to delete the folder or message by it’s entry ID from a PST file.

I have attached this post thread to the ticket ID (29446) associated with this feature . As soon as this feature is available, you will be automatically notified.


Hi Expert,

As you said that this feature on our road map with release of Aspose.Email for .NET 2.0 and i will be notified regarding this matter,but can you tell me when i expect to be ready to use this product feature any date? because it is urgent.

Thanks and Regards,

Hi Sarfaraj,

I am afraid, I do not have the release date at the moment. But I can inquire it from our development team and will let you know here.

Thank you for your patience.

Hi again,

Aspose.Email for .NET v1.2.0 will be available for public use in first quarter of December 2011.


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

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

FolderInfo.DeleteChildItem() method was added to delete an item from PST file.

Sample code:
PersonalStorage pst = PersonalStorage.FromFile(strBaseFolder + strPSTFile);

// Get the Sent Items folder
FolderInfo folderInfo = pst.GetPredefinedFolder(StandardIpmFolder.SentItems);
MessageInfoCollection msgInfoColl = folderInfo.GetContents();
foreach (MessageInfo msgInfo in msgInfoColl)
Console.WriteLine(msgInfo.Subject + ": " + msgInfo.EntryIdString);
if (msgInfo.Subject.Equals(“some delete condition”) == true)
// delete this item
Console.WriteLine(“Deleted this message”);

HI Expert,

As i am evaluating aspose.email.outlook product i came across one issue that it doesnot allow me to open pst file in outlook when i open pst file in outlook to check message because program does not close instance of pst file.how should i close pst file ?

<!–[if gte mso 9]>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}




Hi Sarfaraj,

I am afraid, I am unable to replicate your said issue on my end. I have created a new PST file from a console application. As soon as the application completed it’s execution, I was able to open the newly created PST in Outlook 2010.

If I have misunderstood your scenario then please correct me.

Note: You can also initialize the PersonalStorage instance in using statement to correctly dispose the object.

using (PersonalStorage pst = PersonalStorage.FromFile(“file.pst”))
//do some processing

Hi Babar Raza,

i made correction i.e using (pst) still having problem .my requirement is that using aspose.email.outlook .pst i read all folder, subfolder,iterate through all message when it comes to check message entry id look at this snippet(for testing purpose )

MessageInfoCollection messageInfoCollection = folderInfo.GetContents();
foreach (MessageInfo messageInfo in messageInfoCollection)
Response.Write("Subject: " + messageInfo.Subject);
[//Response.Write](https://response.write/)("Sender: " + messageInfo.SenderRepresentativeName);
[//Response.Write](https://response.write/)(“Recipients: " + messageInfo.DisplayTo);
Response.Write(“EnryID: " + messageInfo.EntryIdString);
if (messageInfo.EntryIdString.Equals(“AAAAAPi8BgLjGitHmY3d/sTJboTkDCAA”) == true)
// // delete this item
Response.Write(“Deleted this message”);

it delete the item ,thing is that when i open pst file in outlook it show"
Cannot display the folder. Microsoft Outlook cannot access the specified folder location. The operation cannot be performed because the object has been deleted."

Thanks &Regards,

Hi Sarfaraj,

Thank you for the correction.

I have tried with several PST files and I am still unable to replicate your said issue on my end. I have managed to delete some messages from different sub-folders of the PST file. After deleting the messages, I opened the PST in Outlook 2010 and the result is as expected. The messages are deleted and I can browse the rest of the messages from same folder.

Although I have two observations,
  • Deleted message does not go to “Deleted Items” folder of the PST. It simply vanishes.
  • I have to close the Outlook to process the PST file from my sample application, even if it is not loaded in Outlook.
I am looking for the answers in regard to above two points.

Regarding your said issue, will it be possible for you to share a sample PST file (of some small size) that can exhibit the issue.


Thanks for your help, At my end i am trying to fix this issue since you have tested several time you are not getting any issue .can i have your aspose email id so that i can send you message regarding any issue.


Hi Sarfaraj,

You can always contact us via forums or Live Chat and we will provide you all the assistance that you may require to solve your issues related to Aspose products.

Regarding the issue, I will keep you posted with my findings.

Thank you,

Hi Babar Raza,
how can i read folder and subfolder for e.g Inbox/MQ/VQ blah blah within click event.
this is csv part thar read from csv and compare with pst using aspose mail functionality

while (objReader.ReadRecord())

string sMailSubject = objReader["$MailSubject"];
public void ExtractMessage(FolderInfo folderInfo, PersonalStorage pst)
MessageInfoCollection messageInfoCollection = folderInfo.GetContents();
if (folderInfo.HasSubFolders == true)
foreach (FolderInfo subfolderInfo in folderInfo.GetSubFolders())
ExtractMessage(subfolderInfo, pst);
foreach (MessageInfo messageInfo in messageInfoCollection)

if (messageInfo.Subject.Equals(sMailSubject) == true)

Issue is this that i pass csv file in that csv message subject is compared with aspose recursive function for e.g in csv message subject is “Hi” now that message subject is compared with pst if it exist in pst it get deleted .is there any way to read all folder ,subfolder and message without using recursive method to enable comparison and deletion

Any Help Would be Appreciated
Thanks &Regards,

Hi Sarfaraj,

I am afraid there is no way to list all messages from all sub-folders of a PST file in one call. You have use recursive calls to list all messages in a PST.

Are you having any issues with your current implementation?