Some really cool functionality that you can put together is to automate saving emails from your Outlook email application to be stored in a SharePoint document list. This lets your users keep using the tools they are comfortable working with (such as Outlook), but helps make sure that important emails are backed up to a reliable storage and reporting medium like SharePoint with as little effort on the user’s part as possible. Continue reading “VSTO Add a Menu Item to Outlook and Save an Email into SharePoint”
VSTO for MS Outlook can be a powerful way to customize Outlook programmatically. However, the syntax can be finicky at times and I have found a few instances where the programming logic becomes tricky.
For example, you can use VSTO to add a text box to the Outlook command bar window. This can be put to a number of good uses when building a custom component for Outlook. My thoughts behind adding the controls to Outlook were to allow the user to select a type of search to run in the custom dropdown list, and then to use the text box for the user to add text that the system would use to run a search on custom email fields.
In my case I wanted to add a textbox and a ComboBox to my main Outlook Explorer view. The VSTO controls in Outlook are called msoControlEdit and msoControlComboBox respectively.
At first glance adding a simple text box and dropdown list sounds like a simple requirement. But as I found out, this isn’t quite the case. The problem? Outlook by default will clear any entered text from the new text box when focus is lost. I’m not sure what the reasoning behind this is, but from reading help articles and forum posts, it appears that many people are coming up against the same problem.
As a positive, the ComboBox control does retain selected text, so we will not need to worry about handling this control.
For the convenience of readers of this article; I am including a full example of how to add a textbox and a ComboBox to the Outlook main command bar at the end of this article.