Recent Posts
Archives
Topics

Tuesday, July 21, 2009

 

VSTO with Outlook 2003

I'm creating a VSTO plugin for Outlook 2003. My problem? I'm using DevStudio 2008 professional.

It has a project template for Outlook 2003 add-ins, but be warned. It is far from complete.

I was able to build my add-in, but distributing it became a nightmare. A royal, amazingly difficult, pain in the gluteus-maximus.

So, how'd I get it installed? First, I had to make sure that the Visual Studio Tools for Office Runtime was installed on each PC.
  • You can download that here

    Next, I had to make sure that (and THIS is the undocumented part that caused me SERIOUS headache) the Primary Interop Assemblies (PIA) for Office 2003 were installed on each PC.
  • You can find those here.

    Next, I had to copy the DLL(s) to the user's hard drive and register each one as able to run. Apparently VSTO (understandably so) has a very very tight security policy. You ahve to register EACH dll that you want to use, and any DLLs that THOSE use. Basically, if you copy it, you register it.

    In order to register the DLL's I used a batch file

    echo Setting Security...
    REM Turn off prompting for a minute.
    "C:\Windows\Microsoft.NET\Framework\v2.0.50727\caspol.exe" -polchgprompt off

    REM Register each DLL using the FULL PATH to the DLL.
    REM Repeat this line for each DLL that you want to register.
    REM I used the same [Project Name] and [Description] for each DLL.
    "C:\Windows\Microsoft.NET\Framework\v2.0.50727\caspol.exe" -u -ag All_Code -url "[Full Path to DLL]" FullTrust -n "[Project Name]" -d "[Description]"

    REM Turn prompting back on. We're done.
    "C:\Windows\Microsoft.NET\Framework\v2.0.50727\caspol.exe" -polchgprompt on


    After setting up all of the applications and security, we now have only one thing left to do... tell Outlook where to find it's new add-in. You ahve to do this via Registry settings.

    I put everything into HKEY_LOCAL_MACHINE instead of HKEY_CURRENT_USER. It seemed to work, but some people suggest against this on the forums. I prefer it, so use which ever one suits you best.

    You can find the registry keys to set here at the bottom of that page.

    After *ALL* of this, I was finally able to get my add-in off the ground. I hope this sincerely helps someone else.

    Labels: , ,


  • This page is powered by Blogger. Isn't yours?

    Subscribe to Posts [Atom]