Exchange 2010 mailboxes inherit IMAP folder views and attributes if imported from a PST dump of an IMAP account

I recently had to migrate 9 IMAP accounts from GoDaddy to our Exchange 2010 server. Since GoDaddy does not offer export services and it was only 9 accounts we decided to use a handful of Outlook profiles to connect to the GoDaddy IMAP accounts and pull down a full copy of the mailboxes. The exact process we used is as follows:

  1. Use Outlook to connect to the IMAP accounts in question and pull down a full copy of the mailbox. You may run into issues accessing multiple large IMAP accounts from 1 Outlook profile. In my experience 5-10 accounts per profile should be ok.
    1. By default Outlook will only pull down the headers of IMAP messages, so you will need to instruct Outlook to do a full sync
    2. This is done under the Send/Receive Ribbon Tab -> Send & Receive Section -> Send/Receive Groups -> Define Send/Receive Groups…
    1. In the Send/Receive Groups window, highlight All Accounts and <click> the Edit…button
    1. Under the Accounts section make sure to highlight the IMAP account in question, and in the section labeled Account Options <select> one folder’s check box. Then <select> the radio button for Download complete item including attachments. Finally <left click> on the same folder and you should see an option to select and apply the same item to all folders with in this IMAP account. Repeat for each IMAP account
    1. Now perform a send/receive and wait for the all the messages to come down
  1. Since Outlook creates a PST file for each synced IMAP account (C:\Users\ACCOUNT\AppData\Local\Microsoft\Outlook) they can be used to directly import the mailbox into an Exchange account
  2. On my Exchange server I created 3 empty accounts (the reaming 6 became distribution groups) and used the following PowerShell command to import each PST into the corresponding empty exchange account
    1. New-MailboxImportRequest –Mailbox USERNAME –FilePath \\NETWORK\PATH\OF\IMAP.PST
    1. You also create a script to pull them all in at once, here’s an example of one way to do it if the PST file names match the user name
      1. Dir \\NETWORK\PATH\OF\*.PST | %{New-MailboxImportRequest –Name ImportOfPst –BatchName ImportPstFiles –Mailbox $_.BaseName –FilePath $_.FullName}

In our case these imported mailboxes belonged to a small consulting company that was purchased by my company. The users getting these email boxes already had accounts on our Exchange 2010 server and these imported accounts would be used to continue any business correspondences still associated with the old company.

So we gave the user’s send as and full access to their imported accounts and let auto-map do its magic. The issue we ran into was that while they could see the imported mailbox all new emails did not show up even though the unread count was increasing. When we checked via EWS, Active Sync, and Outlook Web Access the new items were visible.

After some poking around we noticed that while the folders and mail items were imported into an Exchange mail box, they retained the folder views associated with an IMAP account. The default view  of an IMAP account is to Hide Messages Marked for Deletion, but what it actually does is filter all the messages with the IMAP status of Unmarked.

The idea is to hide any IMAP messages marked for deletion that haven’t synced up with the IMAP server. Since Exchange messages do not have this field they would not show up with this filter applied. If the view is changed to IMAP Messages, which applies no filter, then all the messages show up. You can even apply this view to all the other mail folders. But a more elegant solution would be to remove the views all together, especially if you have hundreds of mailboxes having the same issue.

There are two ways I found to do this, one is a manual process that can only correct 1 folder at a time. The other is intended to correct mailboxes by the batch, but can also be applied to 1 mailbox

First method (Manually change each folder in a mailbox)

Using MFCMAPI you can change each email folder attribute from an IMAP designation (IPF.Imap) to an Exchange designation (IPF.note). MFCMAPI requires you to have access to the mailbox in question and a mail profile setup to access it (you can create one on the 1st run of the program). So you can either run the application from the user’s profile or a profile with access to the account:

  1. Start the program and login to your mail profile by going to Session -> Logon and select the profile that has access to the mailbox you need to edit. Once connected highlight that mailbox, <left click> and select Open Storefrom the drop down menu
  1. Once in the store navigate to the Top of the Information store. Depending on if this is mailbox is the default for the profile or added to it (via the Full Accesspermission) the folder tree is slightly different
    1. Default for profile : IPM_SUBTREE
    1. Secondary : Root Container -> Top of Information Store
  1. Now highlight the mail folder in question and look for the Property named PR_CONTAINER_CLASS, PR_CONTAINER_CLASS_A, ptagContainerClass and <right click> and select Edit Property… from the drop down menu
  1. From here you can edit the ANSI entry, which you’ll want to change from IPF.Imap to IPF.Note. Then <click> the OKbutton
  1. Repeat for all the mail folders in the container and exit the program when you are done.

Second method (“Find and Replace” batch method)

You’ll need a program from Microsoft called EXFolders, which you will install and run from the Exchange server (see the readme instructions included in the download). The instructions on using this program have been re-purposed form the following TechNet post answer provided by Kevinrk:

  1. Run EXFolders directly from the Exchange Bin folder
  1. Go to File -> Connectand fill the following fields:
    1. Type : Mailboxes
    1. Connect by : Database
    2. Global Catalog Server : Select your GC
    3. Databases : Select the Mailbox Database you want to work on
  1. Now select either the entire Mailbox Database or an individual mailbox you want to correct and select Tools -> Custom Bulk Operation.
  1. In the window labeled Custom Bulk Operation look for the section labeled Overall Filter and enter in the following string to make sure that only the mail folder container class is changed :
    • (&(0x361300iE=IPF.Imap))
  1. Under the section labeled Operations <click> the Add button and then select Other folder properties in the Operation Typewindow
  1. In the Folder properties operation window set the following options
    1. Action : Modify
    1. Property : PR_CONTAINER_CLASS : 0x3613001E
    1. Value : IPF.Note
  1. Once those options are set the Add button and then the OKbutton
  1. When you’re back to the Custom Bulk Operation window <click> OK to run the bulk operation. From here Exfolders will walk through the mailbox container(s) and change each instance of the PR_CONTAINER_CLASS from IPF.Imap to IPF.note

What’s next?

For either method you should have the user restart Outlook to make sure the changes take place. In some cases the IMAP views persisted and I had to reset the user’s views in Outlook (outlook.exe /cleanviews).

About mell9185

IT proffesional. Tech, video game, anime, and punk aficionado.
This entry was posted in Email, Exchange 2010, IMAP, Outlook. Bookmark the permalink.

One Response to Exchange 2010 mailboxes inherit IMAP folder views and attributes if imported from a PST dump of an IMAP account

  1. Byron Wright says:

    Thanks for posting this. It was very helpful for me.

    I’d just like to point out that when I used ExFolders to view the PR_CONTAINER_CLASS attribute it was actually 0x361001F (unicode) instead of 0x361001E. However, when you perform the query or make the change to 0x361001E, it actually uses 0x361001F. So, it’s automatically translated in the background. ExFolders will not let you make a bulk change to 0x361001F.

    You also need Full Mailbox access to any mailboxes that you are fixing with ExFolders.

Leave a Reply