• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5157
  • Last Modified:

How to duplicate the Outlook folder structure

Let's say current I have PST store my 2006 email.


Currently the PST is reach the size limit.

So I would like to create another PST for 2007 with current folder structure (they is 10 parent folder and 30 subfolder)

I don't want to copy to another PST and delete all the email to preserve the folder structure,

How to duplicate to the empty mail PST with preserve the folder structure??
2 Solutions
export ,then import or you could do a move
David LeeCommented:
Hi, alexjayaprakash.

I can do it with a fairly simple bi of scripting, if that's an option.  I can post the code for doing this if it is.
alexjayaprakashAuthor Commented:
Yes, please let me test and confirm.
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

David LeeCommented:

My deepest apologies for taking so long to respond.  I lost track of this question and only now discovered that I hadn't posted the code.  Here's the solution I propose.  Follow these instructions to use it.

1.  Start Outlook.
2.  Click Tools->Macro->Visual Basic Editor.
3.  If not already expanded, expand Modules and click on Module1.
4.  Copy the code below and paste it into the right-hand pane of the VB Editor.
5.  Click the diskette icon on the toolbar to save the changes.
6.  Close the VB Editor.
7.  Click Tools->Macro->Security.
8.  Change the Security Level setting to Medium.
9.  Select the folder you want to duplicate.
10.  Run the macro.  The code does everything for you including creating the new PST file.
Dim olkSrcFolder As Outlook.MAPIFolder, _
    olkDestFolder As Outlook.MAPIFolder
Sub DuplicateFolderStructure()
    Dim strDestFolder As String
    Set olkSrcFolder = Application.ActiveExplorer.CurrentFolder
    strDestFolder = InputBox("Enter a name for the new Personal Folder.", "Duplicate Folder Structure")
    If strDestFolder <> "" Then
        Session.AddStore strDestFolder & ".pst"
        Set olkDestFolder = Session.Folders.GetLast()
        CreateFolder olkSrcFolder
    End If
    Set olkNewPST = Nothing
    Set olkDestFolder = Nothing
    Set olkSrcFolder = Nothing
    MsgBox "Completed.", vbOKOnly + vbInformation, "Duplicate Folder Structure"
End Sub
Sub CreateFolder(olkFolder As Outlook.MAPIFolder)
    Dim olkSubFolder As Outlook.MAPIFolder
    olkDestFolder.Folders.Add olkFolder.Name
    Set olkDestFolder = olkDestFolder.Folders.Item(olkFolder.Name)
    For Each olkSubFolder In olkFolder.Folders
        CreateFolder olkSubFolder
    Set olkDestFolder = olkDestFolder.Parent
    Set olkSubFolder = Nothing
End Sub

Open in new window

alexjayaprakashAuthor Commented:
No luck..when I try to run I got error "Compile error: Statement Invalid Outside Type Block
David LeeCommented:
What line does the error occur on, or what line is highlighted by the error?
Line 9 generates an errorcode. This can be simply solved by filling in the complete path where tot create the duplicate. Like:
Session.AddStore ("D:\MyDocs\Oultlook\" & strDestFolder & ".pst")

In case somebody else come around trying to find out how to do it...

1) In File Menu click in Archive
2) Select Archive this folder and all subfolders
3) Select the PST with the folder structure you want to duplicate
4) In "Archive items older than" write a date older than any email you have in that PST (for instance, Mon 1990-01-01)
5) Checkmark on the Include items with "Do not AutoArchive" checked
6) Browse where to save the new .PST
7) Click OK
8) Wait for the archiving process to finish.
9) A new PST called "Archive Folders" will appear in the left panel. It will contain the same folder structure but no data items from the old .PST
10) Change the name as needed (right click, properties, advanced, NAME)

see you

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now