IMAP – 365 Migration Export Outlook – iOS doesnt show subfolder – folder structure

Hi,

I found an issue when exporting the user mailboxes from Outlook and Importing into 365.

All the data is there, including the tree structure. But you setup the connection on iOS and No SubFolder structure is there.

In Outlook if you right click on the folder the Type Will be An IMAP including a status : Filtered in the status Bar vs Item and Post as a Normal Folder.

To fix This issue : Run this Macro, this will let you select your TOP Folder and this will applied to the SubFolder.

Change Subfolders

This version of the macro above will walk the folder list and change all folders from IPF.Imap to IPF.Note. This uses the folder picker and you can choose the root folder (top of mailbox) to run it on all folders in your mailbox or a parent folder to run it only on that folder and it’s subfolders.

How to use macros

First: You will need macro security set to low during testing.

To check your macro security in Outlook 2010 or 2013, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, it’s at Tools, Macro Security.

After you test the macro and see that it works, you can either leave macro security set to low.

Open the VBA Editor by pressing Alt+F11 on your keyboard.

To put the code in a module:

  1. Right click on Project1 and choose Insert > Module
  2. Copy and paste the macro into the new module
Option Explicit
Dim SubFolder As MAPIFolder

Sub ChangeFolderClassAllSubFolders()
    Dim i               As Long
    Dim iNameSpace      As NameSpace
    Dim myOlApp         As Outlook.Application
    Dim ChosenFolder    As Object
    Dim Folders         As New Collection
    Dim EntryID         As New Collection
    Dim StoreID         As New Collection
       
    Set myOlApp = Outlook.Application
    Set iNameSpace = myOlApp.GetNamespace("MAPI")
    Set ChosenFolder = iNameSpace.PickFolder
    If ChosenFolder Is Nothing Then
GoTo ExitSub:
    End If

    Call GetFolder(Folders, EntryID, StoreID, ChosenFolder)
        ChangeFolderContainer
        
    For i = 1 To Folders.Count
        Set SubFolder = myOlApp.Session.GetFolderFromID(EntryID(i), StoreID(i))
        On Error Resume Next
        ChangeFolderContainer
    
        On Error GoTo 0
    Next i     
ExitSub:      
End Sub
    
  
Private Sub ChangeFolderContainer()
Dim oFolder As Outlook.folder
Dim oPA As Outlook.PropertyAccessor
Dim PropName, Value, folderType As String

PropName = "http://schemas.microsoft.com/mapi/proptag/0x3613001E"
Value = "IPF.Note"

On Error Resume Next
Set oFolder = SubFolder 'Application.ActiveExplorer.CurrentFolder
Set oPA = oFolder.PropertyAccessor

folderType = oPA.GetProperty(PropName)
Debug.Print SubFolder.Name & " " & (folderType)

If folderType = "IPF.Imap" Then

oPA.SetProperty PropName, Value
Debug.Print "     Changed: " & SubFolder.Name & " " & Value

End If

Set oFolder = Nothing
Set oPA = Nothing
End Sub
     
    
Sub GetFolder(Folders As Collection, EntryID As Collection, StoreID As Collection, Fld As MAPIFolder)
    Dim SubFolder       As MAPIFolder
       
    Folders.Add Fld.FolderPath
    EntryID.Add Fld.EntryID
    StoreID.Add Fld.StoreID
    For Each SubFolder In Fld.Folders
        GetFolder Folders, EntryID, StoreID, SubFolder
    Next SubFolder
       
ExitSub:
    Set SubFolder = Nothing
       
End Sub
   

Reference :

Fix the Outlook Folder Type after Exporting an IMAP Account

 

Leave a Reply

Your email address will not be published. Required fields are marked *