I did my VSTO Session (Visual Studio Tools for Office: The Agony and the Ecstasy) at VSLive yesterday. It was very interesting to gauge the reactions. In short, there were a ton of misconceptions about what VSTO is to be used for and what its capabilities are. I really think that next time that I do a VSTO talk – I’m going to devote the first 5 minutes or possibly more to dispelling some of those notions.
VSTO is used to have Office host your application, not the other way around. A lot of people didn’t understand this. The first several questions that I got after the talk were about how to integrate Office into their application for spell checking or hosting the Outlook calendar or read from the contacts in Outlook or any number of other types of integration. VSTO does not help you here. Each of the Office applications have a COM based API that will allow you to leverage that application but it’s not VSTO. You can use COM to load Word, paste text into a document, ask Word to spell check it and get back the list of spelling errors. This is a heavy process – especially if you are doing it for small amounts of text. You can use COM to load Outlook and get the list of contact, appointments and lots of other data. In fact, on the Pocket PC, this is the preferred way to have contacts, scheduling and so on. Again, VSTO does not help you here, COM does.
Actually, it’s interesting to point out that even inside a VSTO application that is hosted inside of an Office application, you are talking to the COM API in order to invoke the spell checker, talk to the list of appointments and so on. It’s just that the PIA (Primary Interop Assemblies) are referenced by default in a VSTO application so that they look like they are .NET APIs, sort of. Actually, that was a large portion of my talk yesterday. Those COM APIs are sometimes painful to work with and have some rather severe limitations.
If you are going to write a VSTO application, you need to go in with your eyes open. You are not dealing with a .NET API designed by the same guys that designed the rest of the .NET libraries. You are dealing with Office. This is good and bad. For better or worse, with VSTO, you have to make your application work like the Office application that is hosting your application. Sometimes this is very frustrating. However, the payoff is immense when you can cut the amount of training that you have to do for your users because they already know the interface.
That’s what VSTO is about. It’s about having Office as your front end because that’s what your users know.