I want to read an MSG file from a Windows folder and place the email in a named sub-folder of the user’s Inbox.
Getting the message into an Aspose MailMessage is easy…
Here’s where I get the message:
Dim importMSG As Aspose.Email.MailMessage
importMSG = Aspose.Email.MailMessage.Load(sFullpath)
but I can’t get my head around how to then put this message into the Outlook folder.
I’m a novice so please be detailed with your replies - thanks.
You can add a message to the Outlook pst file using the following code:
Dim importMSG As MailMessage = Aspose.Email.MailMessage.Load(sFullpath)
Using pst As Aspose.Email.Storage.Pst.PersonalStorage = Aspose.Email.Storage.Pst.PersonalStorage.FromFile(pathToPstFile & "outlook.pst")
Dim inbox As FolderInfo = pst.RootFolder.GetSubFolder("Inbox")
Thanks for the reply Margarita. Unfortunately I don’t want to place the email in a PST, I want to put it in a subfolder of the user’s Inbox.
So imagine that the user has an Inbox sub-folder named “TEMPLATES” and my code needs to place the MSGs that are in a Windows File System folder into this Outlook folder. How can I do that?
Aspose.Email doesn’t use Microsoft Outlook or Office Automation. You can add messages to a pst file directly or use an email client like ImapClient in case Outlook is connected to the server.