save Outlook 2007 email as a msg file from VB.NET 2008

By bethfell ·
I want to save the selected Outlook 2007 email(s) as a msg file(s) from VB.NET (VS 200. I get an error message that says ?You do not have the appropriate permissions to perform this operation.? I set the folder permissions for my profile, default and anonymous to full read, edit all for write and folder owner and folder visible for the other category. (just trying to cover all bases!)

Here?s my code and the error occurs on the save as statement. Thanks in advance for any insight!

Dim i As Int16
Dim temp As Object
Dim mailitem As Microsoft.Office.Interop.Outlook.MailItem
Dim subject As String
Dim strSaveName As String

For i = 1 To OL.ActiveExplorer().Selection.Count
temp = OL.ActiveExplorer().Selection(i)
If (TypeOf (temp) Is Microsoft.Office.Interop.Outlook.MailItem) Then
mailitem = temp
subject = mailitem.Subject.Replace(":", "")
subject = mailitem.Subject.Replace(".", "")
strSaveName = subject & Format(Now, " ddmmyyyyhhnnss") & ".msg"
mailitem.SaveAs(strDir & strSaveName, Microsoft.Office.Interop.Outlook.OlSaveAsType.olMSG)

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Share your knowledge

Related Discussions

Related Forums