More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

To set the storage folder for an outgoing Outlook message

Lotus Notes can prompt the sender to specify what folder a message should be saved in. In Outlook, you can set the storage folder on the Options dialog on a message in versions before Outlook 2007. This VBA code reproduces something closer to the Notes behavior by popping up the Select Folder dialog when the user sends the message. If the user selects a mail folder in the default information store, the message will be stored there after it is sent. Otherwise, it will be stored in the default Sent Items folder.

To try this code, paste it into the built-in ThisOutlookSession module in Outlook VBA. If you haven't used Outlook VBA before, see Outlook VBA Basics.

Code Sample

 

Notes

This technique does not work on messages created with File | Send commands in Office programs or similar commands in Windows Explorer or other programs. Those commands invoke Simple MAPI, which bypasses Outlook functionality. An alternative approach would be to monitor the Sent Items folder for new items and ask the user to refile the message at that point in its lifetime. You would also use the Sent Items approach if you wanted to save items to a folder that is not in your default information store (Exchange mailbox or PST file). The IsInDefaultStore() function tests for the location of the target folder.

This code demonstrates the use of the Namespace.PickFolder method to pop up the folder list for the user's selection. Note that you must handle the situation where the user cancels the dialog, in which case PickFolder returns Nothing.

Another variation would be to not save the item at all if the user doesn't choose a folder. You can do that by setting the DeleteAfterSubmit property to True.

More Information

Additional samples using the Application.ItemSend event