Moving from an IMAP based mail hosting to Office365 Exchange is easy. I changed some information in the DNS of my domain, created a user in Office365 and started using Exchange Online with my Outlook on Windows and macOS. Last but not least I exported my old mailbox in Outlook and reimported it with Outlook connected with the new Office365 mailbox. Done! – Everything works pretty well. BUT: On my iPhone, most of the subfolders in the Office365 mailbox are missing. The same problem using the native Mail app and the iOS Outlook app. WTF?
It takes me hours the find the problem and a solution.
The Problem: Folders are still tagged as “IMAP folders”
While importing a PST file originally created with Outlook connected to an IMAP mail-system into an Outlook connected to an Exchange (Online) mail-system, the problem starts. Only some of the imported subfolders were converted from an “IMAP folder” to an “Exchange folder”. I don’t know why some of them were tagged as an Exchange folder and some not. But it is as it is. It ends in trouble.
Here you can easily understand the problem: Open Outlook, select a subfolder an open the View section.
The Solution: Change „PR_CONTAINER_CLASS“
And yes, you will have to do this for each folder. But the good news is, Robert Sparnaaij (MVP für Office) created a simple VBA script to fix the whole folder structure.
'This script fixes imported IMAP folders. 'It does this by modifying the value PR_CONTAINER_CLASS property; 'The value is schanged from IPF.Imap to IPF.Note. 'Script created by: Robert Sparnaaij 'For more information about this file see; 'http://www.howto-outlook.com/howto/fix-imported-imap-folders.htm 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
- Start your Outlook on Windows
- Copy the script into a text file on your Desktop and safe it as “FixIMAP.
- You wouldn’t need any administrative rights, so it’s easy to use
- Double-click the .vbs file (start the script)
- Now your Outlook wants to know which folder should be converted
- Select the Exchange base top-folder you want to fix
- The script now wants to know if it should fix your subfolders, too.
- Answer with yes, because that’s the thing we want to do
- Depending on the size and number of folders the script will run a few seconds.
- That’s it. All folders should now be tagged as “Exchange folders”.
- Wait until your Outlook synchronized the modifications with Exchange (Online)
It’s magic …
Try to synchronize the Exchange (Online) mailbox with your mobile app. Now you should (and will) see all folders of your mailbox.
Pretty simple – if you know how
I hope I helped you not to spend hours searching Google for a solution.
That is great ! Thank you
Thank you for this! I was having this issue for months and couldn’t figure it out. This script fixed the problem!
This page was pretty helpful along with https://bugs.mysql.com/bug.php?id=89931 and https://github.com/openlink/iODBC/issues/29.
Hi Parker, thank you for your comment and the useful links!
Thank you! This problem has been plaguing me for 15 months!
My Friend, I love you so much
I was pleased to do that. I faced the same problem. And if it can solve then you should share the knowledge with others. 2x have to look for the same solution when others have already done it, is always stupid 😉
Many thanks for helping sort out my sync issue.. Perfect result going from imap to exchange
Brilliant. It worked a treat. Thank you.