SOM Information Technology Service Catalog

When you’ve exported your IMAP mailbox or specific folders to a pst-file which you then later open in Outlook or import into an Exchange or mailbox, you may be shocked to see that these folders don’t contain anything. Additionally, when you configure this mailbox on a smartphone or tablet as an Exchange ActiveSync account, these folders may not show at all.

Luckily, this can be fixed without any data loss but the process to do so via MFCMAPI is not for the faint of heart or when you have many folder to fix.

Background info and workaround solution

This issue happens because the export/import process maintains the IMAP folder properties which aren’t compatible with a regular pst-archive or Exchange/ account.

More specific (and technical), the folder class property is set to IPF.Imap instead of IPF.Note. This has various negative side-effects, visual “glitches” and functionality issues such as;

  • You still don’t have Follow Up flags such as Today, Tomorrow, This Week, etc… for these imported folders.
  • You’ll see a “Filter applied” message in the bottom left corner of the Status Bar.
  • When you switch to the View tab and press the Change View button, you’ll see views that are specific for IMAP accounts even though you are now working with a pst-file or Exchange mailbox. Right now, it is probably set to “Hide Messages Marked for Deletion”.
  • The folders are not visible when you connect to your mailbox via Exchange ActiveSync on your smartphone or tablet or the Windows 10 Mail app.

Views available to an IMAP folder.
Looking at the available Views allows you to determine whether a folder is being treated as an IMAP folder.

A quick way to see all your messages again is to set you view to “IMAP Messages”.

This will however not fix the actual issue and will not make the folders visible again on your smartphone or tablet. To actually solve it, you’ll need to use one of the methods below to change the folder class property.

For future reference:
Instead of exporting and importing your data from your IMAP account, you could also copy it directly from your IMAP account into a pst-file or an Exchange mailbox. This will copy the contents of the folder without maintaining the IMAP specific properties.

Method 1: Automated fix with a script

VBS Script buttonThe script below will fix the incorrect folder class property for you so that it will become a regular mail folder again just like all the others.

After running the script, you’ll immediately see all your emails again, have Follow Up flag support and all other aforementioned issues will be gone. You don’t even need to restart Outlook!

The script allows you to fix a single folder, a folder and its subfolders or your entire mailbox at once. It will automatically recognize folders that don’t need any fixing and won’t make any changes to these either.

Download the file

  1. Open or extract the zip-file, and double click on; FixImportedIMAPFolders.vbs
  2. Click on Outlook in the Taskbar to see the “Select Folder” dialog.

    Select Folder Dialog

  3. Select the folder that you would like to fix and press OK.
    • If you’d like to fix all subfolders that need fixing as well, select the parent folder.
    • If you’d like to fix all folders within your entire mailbox that need fixing, simply select the mailbox name.
  4. You’ll now get a prompt whether you want to include the subfolders as well. If you don’t see this prompt, click on the script icon in your Taskbar.

    WScript icon on the Taskbar
    Click on the WScript icon in the Taskbar…

    …and select your fixing preference.

  5. After the script is done, you’ll get a notification with how many folders have been fixed.

The contents of all the fixed folders should now be visible again and you should no longer have any IMAP view or any of the other aforementioned issues.

If you had the folder still selected in Outlook, select a different folder and then go back to the fixed folder so that Outlook can refresh the view and you can see that it is fixed.

FixImportedIMAPFolders.vbs script contents

The following code is contained in the FixImportedIMAPFolders.vbs file.

Dim i

Call FolderSelect()

Public Sub FolderSelect()
  Dim objOutlook
  Set objOutlook = CreateObject("Outlook.Application")

  Dim F, Folders
  Set F = objOutlook.Session.PickFolder

  If Not F Is Nothing Then
    Dim Result
    Result = MsgBox("Do you want to include the subfolders?", vbYesNo+vbDefaultButton2+vbApplicationModal, "Include Subfolders")

    i = 0

    If Result = 6 Then
      Set Folders = F.Folders
      LoopFolders Folders
    End If

    Result = MsgBox("Done!" & vbNewLine & i & " folder(s) have been fixed.", vbInfo, "Fix Imported IMAP Folders")
    Set F = Nothing
    Set Folders = Nothing
    Set objOutlook = Nothing
  End If
End Sub

Private Sub LoopFolders(Folders)
  Dim F
  For Each F In Folders
    LoopFolders F.Folders
End Sub

Private Sub FixIMAPFolder(F)
  Dim oPA, PropName, Value, FolderType

  PropName = ""
  Value = "IPF.Note"

  On Error Resume Next
  Set oPA = F.PropertyAccessor
  FolderType = oPA.GetProperty(PropName)

  'MsgBox (F.Name & " - " & FolderType)

  If FolderType = "IPF.Imap" Then
    oPA.SetProperty PropName, Value
    i = i + 1
  End If

  Set oPA = Nothing
End Sub

Help us improve
Your Rating: Results: 1 Star 2 Star 3 Star 4 Star 5 Star 83 rates