Imported IMAP folders are not visible or don’t show any content

IMAP Folders buttonWhen 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 Outlook.com 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.

Therefor, this guide also contains a script which you can run to apply the fix for you. You can either fix a single folder, a folder and its subfolders or your entire mailbox at once.


Background info and workaround solution

Why? buttonThis issue happens because the export/import process maintains the IMAP folder properties which aren’t compatible with a regular pst-archive or Exchange/Outlook.com 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.

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

    Select Folder Dialog

  4. 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.
  5. 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…

    Prompt - Do you want to include the subfolder?
    …and select your fixing preference.

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

    Reset Migrated IMAP Folder - Done!

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
    FixIMAPFolder(F)

    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
    FixIMAPFolder(F)
    LoopFolders F.Folders
  Next
End Sub

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

  PropName = "http://schemas.microsoft.com/mapi/proptag/0x3613001E"
  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

Method 2: Manual fix with MFCMAPI

MFCMAPI buttonTo manually fix the folders, you can change the PR_CONTAINER_CLASS value of the folder from IPF.Imap to IPF.Note via MFCMAPI.

This is the exact same fix that is being applied by the script featured above.

Warning!
MFCMAPI is a low-level mailbox editing tool which is designed for expert users and developers so pretty much all safety nets are missing and making a mistake could result in total destruction of your mailbox data. So if this doesn’t like something for you, you may want to use the script method instead.

  1. Download MFCMAPI from its official project page on GitHub.
    • When you use a 32-bit version of Outlook, you’ll need the file starting with;
      MFCMAPI.exe
    • When you use a 64-bit version of Outlook, you’ll need the file starting with;
      MFCMAPI.exe.x64
  2. Unzip the downloaded file and from the extracted folder double click on mfcmapi.exe.
  3. Dismiss the startup screen.
  4. Logon via; Session-> Logon…

    MFCMAPI - Session -> Logon...

  5. Select the mail profile which contains the folder you wish to alter.
    If you’ve never seen this dialog before, just click OK to load your default mail profile.

    Choose Profile dialog

  6. Double click on the mailbox store containing the folder you wish to alter.

    Select Data Store - MFCMAPI

  7. Expand: Root Container
  8. Depending on your account configuration expand the following folder:
    • IPM_SUBTREE
    • Top of Outlook data file
    • Top of Personal Folders
    • Top of Information Store
  9. Select the folder that you wish to fix.

    PR_CONTAINER_CLASS property for imported IMAP Inbox folder - MFCMAPI

  10. Double click on the PR_CONTAINER_CLASS property.

    PR_CONTAINER_CLASS set to IPF.Imap - MFCMAPI

  11. Change the IPF.Imap value into IPF.Note.

    PR_CONTAINER_CLASS set to IPF.Note - MFCMAPI

  12. Click OK.
  13. Repeat step 9 to 12 for any other folders that you wish to fix.
  14. Close all the open MFCMAPI windows.

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.