Add message to PST Error: Impossible to perform the operation

I am attempting to add a message to the drafts folder in a PST.


The Aspose.Email.Outlook.Pst.FolderInfo.AddMessage() method throws the exception "Impossible to perform the operation.“

Code:

Dim Pst As Aspose.Email.Outlook.Pst.PersonalStorage = Aspose.Email.Outlook.Pst.PersonalStorage.FromFile(“C:\Users\hilimirew\Desktop\Outlook_OLD4.pst”)
Dim Drafts As Aspose.Email.Outlook.Pst.FolderInfo = Pst.RootFolder.GetSubFolder(“Drafts”)

Dim Msg As New Aspose.Email.Outlook.MapiMessage()
Msg.Recipients.Add("test@nowhere.com”, “Test”, Aspose.Email.Outlook.MapiRecipientType.Unknown)
'Msg.Attachments.Add(“Notice re increase in payment percentage as of November 5 2014.pdf”, IO.File.ReadAllBytes(“C:\Users\hilimirew\Desktop\Notice re increase in payment percentage as of November 5 2014.pdf”))
Msg.Subject = “test”
Msg.Body = “xyz”



Stop

Drafts.AddMessage(Msg)


MsgBox(“Done”)

Hi Wilford,


Thank you for contacting Aspose support team.

I have used your code to test the scenario with a sample PST and PDF file and found that this code is working fine for Aspose.Email for .NET 4.9.0. It seems to be some specific issue with your PST or PDF file. You may please test this scenario again with some other PST and/or PDF file and if problem is not resolved, please send us the sample PST and PDF file.

Also please elaborate how the PST is created i.e. either by using Aspose.Email or some other software? If it is created using Aspose.Email, then send us the sample code for PST creation along with any sample contents added to PST (if any).


Thanks for the prompt reply. PST file was corrupt…

Hi Wilford,


We are glad to know that your problem is solved. Please feel free to write us back if you have any other query related to Aspose.Email.