can i copy/move a folder in outlook into a normal folder structure ?

I have a user who wants to be able to save a subfolder in outlook into a normal explorer folder on the shared server drive. Some thing as simple as drag and drop or a 3rd party.

I know you can't do drag and drop. And the user doesn't under stand the export to pst...

Ideally, the folder that is copied would have the emails in it as per a normal folder setup.
total123Asked:
Who is Participating?
 
David LeeConnect With a Mentor Commented:
They'll be email files, not .pst files.

Here's the solution I had in mind.

Adding the code to Outlook.

1.  Start Outlook.
2.  Press ALT+F11 to open the Visual Basic Editor.
3.  If not already expanded, expand Microsoft Office Outlook Objects.
4.  If not already expanded, expand Modules.
5.  Select an existing module (e.g. Module1) by double-clicking on it or create a new module by right-clicking Modules and selecting Insert > Module.
6.  Copy the code from the code snippet box and paste it into the right-hand pane of Outlook's VB Editor window.
7.  Edit the code as desired.  I included a comment wherever something can be changed.
8.  Click the diskette icon on the toolbar to save the changes
9.  Close the VB Editor

'On the next line edit the starting folder as desired.  If you leave it blank, then the starting folder will be the local computer.
Const STARTING_FOLDER = ""

Dim objFSO As Object

Sub CopyOutlookFolderToFileSystem()
    ExportController "Copy"
End Sub

Sub MoveOutlookFolderToFileSystem()
    ExportController "Move"
End Sub

Sub ExportController(strAction As String)
    Dim olkFld As Outlook.MAPIFolder, strPath As String
    strPath = SelectFolder(STARTING_FOLDER)
    If strPath = "" Then
        MsgBox "You did not select a folder.  Export cancelled.", vbInformation + vbOKOnly, "Export Outlook Folder"
    Else
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set olkFld = Application.ActiveExplorer.CurrentFolder
        ExportOutlookFolder olkFld, strPath
        If LCase(strAction) = "move" Then olkFld.Delete
    End If
    Set olkFld = Nothing
    Set objFSO = Nothing
End Sub

Sub ExportOutlookFolder(ByVal olkFld As Outlook.MAPIFolder, strStartingPath As String)
    Dim olkSub As Outlook.MAPIFolder, olkItm As Object, strPath As String
    strPath = strStartingPath & "\" & olkFld.Name
    objFSO.CreateFolder strPath
    For Each olkItm In olkFld.Items
        olkItm.SaveAs strPath & "\" & RemoveIllegalCharacters(olkItm.Subject) & ".msg", olMSG
    Next
    For Each olkSub In olkFld.Folders
        ExportOutlookFolder olkSub, strPath
    Next
    Set olkFld = Nothing
    Set olkItm = Nothing
End Sub

Function SelectFolder(strStartingFolder As String) As String
    ' This function is a modified version of the SelectFolder function written by Rob van der Woude (http://www.robvanderwoude.com/vbstech_ui_selectfolder.php)

    ' Standard housekeeping
    Dim objFolder As Object, objShell As Object
    
    ' Custom error handling
    On Error Resume Next

    ' Create a dialog object
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.BrowseForFolder(0, "Select the folder you want to export to", 0, strStartingFolder)

    ' Return the path of the selected folder
    If TypeName(objFolder) <> "Nothing" Then SelectFolder = objFolder.self.Path

    ' Standard housekeeping
    Set objFolder = Nothing
    Set objShell = Nothing
    On Error GoTo 0
End Function

Function RemoveIllegalCharacters(strValue As String) As String
    ' Purpose: Remove characters that cannot be in a filename from a string.'
    ' Written: 4/24/2009'
    ' Author:  BlueDevilFan'
    ' Outlook: All versions'
    RemoveIllegalCharacters = strValue
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "<", "")
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, ">", "")
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, ":", "")
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, Chr(34), "'")
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "/", "")
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "\", "")
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "|", "")
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "?", "")
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "*", "") 
End Function 

Open in new window


Using the Macro.

1.  Select an Outlook folder.
2.  Run either the CopyOutlookFolderToFileSystem or the MoveOutlookFolderToFileSystem macro depending on whether you want to copy/move the folder to the file system.

Adding Buttons to Run the Macro with a Single Click

If you want to run the macro with a single click, then you'll need to add toolbar buttons for each macro in Outlook 2007 or buttons on the Quick Access Toolbar (QAT) for Outlook 2010.

Outlook 2007.  Follow these instructions to add toolbar buttons that runs each macro.

Outlook 2010.  Follow these instructions to add the macros to the QAT.
0
 
greggy86Commented:
I doubt you will be able to do this for free... but I hope I can be proven wrong.
This $79 plugin does what you ask: http://www.encryptomatic.com/messageexport/
0
 
btdownloads7Commented:
I'm almost positive that there is nothing that will do what you ask. It's not that complicated technically, but I highly doubt that anyone has gone to the trouble of exporting Outlook email data into a file-based sttructure.
0
Easily manage email signatures in Office 365

Managing email signatures in Office 365 can be a challenging task if you don't have the right tool. CodeTwo Email Signatures for Office 365 will help you implement a unified email signature look, no matter what email client is used by users. Test it for free!

 
David LeeCommented:
Hi, total123.

If a script-based solution (i.e. an Outlook macro) is acceptable, then I can make this happen.  It wouldn't be drag-n-drop though.  The user would select a folder and run the macro.  The macro would prompt them for the file system folder they want to export to.  Once they supplied that it would create a new folder and export the contents of the Outlook folder to it.  Would that work?
0
 
total123Author Commented:
hi bluedevil

that sounds good, would it export the files as email files or into a pst format.

he's looking for the email file format.
0
 
total123Author Commented:
excellent macro
0
 
David LeeCommented:
Thanks!
0
All Courses

From novice to tech pro — start learning today.