Sunday, October 23, 2011

How to Make Outlook Function Like GMail

If you're a gmail user forced to use outlook for certain tasks such as work then you understand how frustrating it can be to lose the gmail functionalities and interface. Several posts describe how to capture some of gmail's most useful behaviors in outlook, namely threaded conversations including sent mail:
  • Outlook 2007 has better ways of merging sent mail with your inbox. The
  • Ultimate Inbox uses a rule to redirect all sent mail to your inbox with the caveat that it will appear there unread and include items you normally don't want in your inbox like new messages you send out not in reply to something else. As pointed out in the comments these issues can be circumvented by 1) creating a new folder that will be used as your new Inbox, 2) creating a new rule that moves all new mail to that new folder, and 3) enabling the option for "In folders other than the Inbox, save replies with original message." This approach works but you lose the sent mail categorization.
  • An alternative solution involves creating an "All mail" search folder that includes the inbox and sent items as suggested by Aelij. This presents an organizational problem since this folder by definition includes everything. Dan Brett improved on this idea by creating a filter to exlude email older than a specified cut-off date, but the functionality of inbox as an organizational tool is somewhat lost.
None of these approaches take full advantage of labels and search folders in outlook. By treating both the inbox and sent items as categories rather than folders, it's possible to capture more of Gmail's functionality including the ability to archive conversations.


Getting Started
First select all of the items in your inbox and click on the 'Categories' button.

Create a new category called "Inbox" and make sure the box next to it is checked. Now when you press OK this category will be applied to every message that you have selected.



Repeat this process for messages in your 'Sent Items' folder by categorizing them as "Sent Mail".

Next we'll create a single folder in which to compile all messages. This folder can either be located in your mailbox or a local 'Personal Folder'. If you have unlimited space or need to access your email from a mobile device then you may want to utilize your mailbox for this folder. The use of local folders complicates the handling of ougoing messages, but once set up you never have to worry about shifting messages around again. This may be especially useful if your company automatically clears your mailbox of messages older than 60 days or something like that. In Outlook 2007 it is important to have all of your messages in one place because search folders in this version cannot span multiple mailboxes.


Create a new folder called "All Mail" making sure the "Personal Folders" location is highlighted.





Now move all of the categorized messages from your 'Inbox' and 'Sent Items' folder to the folder you just created. This is also a good time to convert any other folders you may have to categories and consolidate all of your messages in one place. You can always fish out what you want later using search folders.


The first search folder you need to create will replace the function of your old inbox. Press Ctrl+Shift+P to create a new search folder and highlight 'Create a custom Search Folder' in the dialog box.


Name the search folder "Inbox" and click on the 'Criteria' button.





From the window that pops up select the 'More Choices' tab in the next dialog box then click on the 'Categories' button to select the "Inbox" category.


Press OK and this should take you back to the 'Custom Search Folder' window. Click on the 'Browse' button and uncheck the "Personal Folders" box and check the one next to "All Mail"




The screenshot below shows what the 'Custom Search Folder' window should look like once properly configured.


Repeat the above steps to create a search folder for messages with the "Sent Mail" category along with any others you want.


Now we need to create a rule so that all new outgoing messages are caterorized as "Sent Mail". To do this click on 'Rules and Alerts' from the 'Tools' menu and then click on the 'New Rule' button.




In the window that pops up highlight 'Check messages after sending' and hit 'Next'.



Leave all of the boxes unchecked on the next window and hit 'Next' again.




When prompted if you want to apply this rule to all outgoing messages, choose 'Yes'.




In the next window check the appropriate box to assign outgoing messages to the "Sent Mail" category.






At this point the rule is complete so click on 'Finish'.


Now create a second rule to 'Check messages when they arrive' and assign them to the "Inbox" category as well as move them to the "All Mail" folder. Again this rule should be applied to all incoming messages.




Now Outlook needs to be configured to move all outgoing messages from the 'Sent Items' folder to the "All Mail" folder. There is an easy way to set this up using Outlook's rules, but annoyingly there is no way to automatically mark these messages as read. The following method should work for both IMAP and exchange accounts.


Open up the visual basic editor by pressing Alt+F11. Navigate to and open 'ThisOutlookSession' in the Project pane on the left side of the screen.



Copy and paste in the following code into the editor window making sure that the folder names specified in the 4th to last line exactly match those you use in Outlook.

Public WithEvents SentItems As Outlook.Items
Private Sub Application_Startup()
    Set SentItems = _
Outlook.Session.GetDefaultFolder(olFolderSentMail).Items
End Sub
Private Sub Application_Quit()
    Set SentItems = Nothing
End Sub
Private Sub SentItems_ItemAdd(ByVal Item As Object)
   
Set olApp = CreateObject("Outlook.Application")
Set ns = olApp.GetNamespace("MAPI")
Set AllMail = ns.Folders.Item("Personal Folders").Folders("All Mail")
    Item.Move _
AllMail
End Sub

The above code should work in Outlook 2007 but may not function in Outlook 2010. If you use Outlook 2010 use the following VBA to effectively change your default sent items folder:

Public WithEvents SentItems As Outlook.Items
Private Sub Application_Startup()
    Set SentItems = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderSentMail).Items
End Sub
Private Sub Application_Quit()
    Set SentItems = Nothing
End Sub
Private Sub SentItems_ItemAdd(ByVal Item As Object)
     Dim olApp As New Outlook.Application
     Dim olNameSpace As Outlook.NameSpace
     Dim olCurrExplorer As Outlook.Explorer
     Dim olCurrSelection As Outlook.Selection
    
     Dim olDestFolder As Outlook.MAPIFolder
     Dim olCurrMailItem As MailItem
    
     Set olNameSpace = olApp.GetNamespace("MAPI")
    
     Set olDestFolder = olNameSpace.Folders("Personal Folders").Folders("All Mail")

    Item.Move olDestFolder
End Sub

Save and close the editor. Restart Outlook and choose to enable macros when prompted. This code was originally obtained from Ken Sheppardson's Outlook "Sent Items" Hack which redirects email to the Inbox. I modified this code to instead move outgoing messages to the "All Mail" folder using code that I found here and here which describe how to point to the Personal Folders and its subfolders, respectively.


Now your conversations including your replies can be properly threaded in the "All Mail" folder. However if you reply to or forward a message in your inbox search folder, for instance, then that outgoing message should automatically retain or inherit the categories of the original message/conversation such that it appears in your inbox search folder as well as the "All Mail" folder. Outlook is not configured to do this by default since it is set to strip category information from outgoing messages, but you can change this behavior by adding a single 32-bit DWORD value to the registry. The reg file to add this entry for you can be obtained here.


To enable threaded conversation view in Outlook click on the 'View' menu, then 'Arrange by' and 'Conversation'. I've adjusted and rearranged the default columns as shown below to more closely mimic GMail by removing the subject column (redundant with the conversation heading) and adding a message column to show the first few lines of text from each message.


To assign categories to a conversation just select the header and click on the categories button to select the appropriate categories. Deselecting the "Inbox" category effectively archives the conversation.

Note that Outlook still can't match some of GMail's other useful behaviors such as the ability to unarchive entire conversations when a new message is added. Also, while GMail groups conversations by unique identifiers in the message headers Outlook merely discriminates based on subject. This means unrelated messages will be grouped together if they happen to have a common subject such as "meeting".

I hope you found this post helpful. Please leave me feedback and let me know if you see something that could be improved!