Creating Outlook Addon not easy due to security model!
11-June-2008
10am
Wow, who would have thought it would be so hard to write an add on to outlook. (And the code I want to write is only about 10 lines!!!!) But deploying this so it will run without the Windows security model getting in the way has taken many hours of my time already! If only I could get on with writing code. (frustrated).
But, as of writing this, Microsoft has made it so hard to deploy an outlook addon that I've almost given up. A brief glance though Part 1 and Part 2 of these documents will give you an idea about why deploying an outlook addon is difficult for Outlook 2003.
But, get a load of this next document for deploying addons for Outlook 2007. The screen shots and file locations are different than my standard install of VS2008, and searching for the sample files mentioned in the document bring up no results.
Well back to it, if I can get this done in under a day I'll be happy, but I'm dubious.
1:45pm
Kevin Farley puts it well: "... the mysterious "COM object could not load" error that befuddles all of us ..."
1:51pm
Same article: "... I was getting the "runtime error: addin can not be loaded" error ... I wasted one whole day to figure out the problem" ~ S.S. Ahmed
2:01pm
And another: "Someone like me new to VSTO and new to .NET and Outlook programming has a mountain to climb to write even the simplest add-in." ~ banjaxed
ColinJMcGrath oh... It's been a long hard day.
3:15pm
Christopher Green writes "Assuming you have wronged someone and karma has dictated you will write an Office Add-in"
3:48pm
Still struggling. Now I can't find the PIAs in Visual Studio prerequisites!! :( Seems the recommended solution is to re-install Office...
3:53pm
F!@k that didn't work.
4:35pm Still can't find the prerequisites, select Microsoft Office 2003 Primary Interop Assemblies and Microsoft Visual Studio Tools for Office Runtime, and cant work out how to install them.
5:12pm
Well, I finally got the security model to work, albiet I skipped the bit about prerequisites (figured out later 5:49pm) and installed the addon and it said Hello World, amazing, only 6 hours or so, and silly me, I thought that was it, but no, the security model holds more lovely surprises in store. So I start to modify a few settings and reinstall it, and it says, sorry, you cant reinstall, already installed. Ok, so I try to uninstall, sorry you can't uninstall, the security model can't be found. Hmm, I can't install a new copy and I can't uninstall the old copy. Microsoft you guys are playing games with me right?
5:49pm
Prerequsites: If you installed the sample solution from the walkthrough,you will have a directory like "C:\Program files\Microsoft Visual Studio 2005 Tools for Office SE Resources\VSTO2005SE Windows Installer Sample\packages\Office2007PIA" on your harddisk. In this directory the package files for the prerequisites definition files are stored. You will also have a directory like: "C:\Program files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages" Here are the standard Package definition files. If you copy over the directories from the sample to the standard directory -> you will have it here.
Lets see eh... Far out, I'm having a win. Why wouldn't they just say that in the walkthrough? Fkn MS. Oh, part 1, well why didn't they say?
12-June-2008
Ok, I'm at it again this morning. Last night I finally got the addon to load in outlook and output Hello World! But going back though the walkthough I thought I'd try and at least finish off some of the major items such as addin the prerequsites. I found that I'd actually installed the wrong version of the VSTO tools!!! I had the original version, not Version 3 So I couldn't work out why I didn't have half the files like ComponentCheck.cpp!
What are the parameters is in your Custom Install Action
2:15pm
From Forum answer about custom actions In the walkthrough custom actions:
/assemblyName="OutlookAddin.dll" /targetDir="[TARGETDIR]\" /solutionCodeGroupName="MyCompanyName.OutlookAddin" /solutionCodeGroupDescription="Code group for OutlookAddin" /assemblyCodeGroupName="OutlookAddin" /assemblyCodeGroupDescription="Code group for OutlookAddin" /allUsers=[ALLUSERS]
The CodeGroupName is "MyCompanyName.OutlookAddin", make sure to change companyname to your company name!! This whole string must exactly be the same in Install, Rollback and Uninstall actions of your setup project.
Recommend Revo Uninstaller if you have the above problem where you can't install or uninstall.
Limitations of the Setup Project
The default Setup project has several limitations:
* By default, the Setup project does not set the security policy. The add-in assembly and any referenced assemblies must be granted full trust for the add-in to run. You can add a step to the Setup project to configure the security policy, or an administrator can set the appropriate security policy. For more information, see Security Requirements to Run Office Solutions (2003 System).
* By default, the Setup project does not check for, or install, the Visual Studio Tools for Office runtime and the primary interop assembly (PIA) for the Microsoft Office application. If these components are not installed on the end user computer, the add-in will not run. For more information about the prerequisites, see How to: Prepare End User Computers to Run Office Solutions (2003 System).
Yeah right: "Security policy can be easily deployed in a Windows Installer"
10am
Wow, who would have thought it would be so hard to write an add on to outlook. (And the code I want to write is only about 10 lines!!!!) But deploying this so it will run without the Windows security model getting in the way has taken many hours of my time already! If only I could get on with writing code. (frustrated).
But, as of writing this, Microsoft has made it so hard to deploy an outlook addon that I've almost given up. A brief glance though Part 1 and Part 2 of these documents will give you an idea about why deploying an outlook addon is difficult for Outlook 2003.
But, get a load of this next document for deploying addons for Outlook 2007. The screen shots and file locations are different than my standard install of VS2008, and searching for the sample files mentioned in the document bring up no results.
Well back to it, if I can get this done in under a day I'll be happy, but I'm dubious.
1:45pm
Kevin Farley puts it well: "... the mysterious "COM object could not load" error that befuddles all of us ..."
1:51pm
Same article: "... I was getting the "runtime error: addin can not be loaded" error ... I wasted one whole day to figure out the problem" ~ S.S. Ahmed
2:01pm
And another: "Someone like me new to VSTO and new to .NET and Outlook programming has a mountain to climb to write even the simplest add-in." ~ banjaxed
ColinJMcGrath oh... It's been a long hard day.
3:15pm
Christopher Green writes "Assuming you have wronged someone and karma has dictated you will write an Office Add-in"
3:48pm
Still struggling. Now I can't find the PIAs in Visual Studio prerequisites!! :( Seems the recommended solution is to re-install Office...
3:53pm
F!@k that didn't work.
4:35pm Still can't find the prerequisites, select Microsoft Office 2003 Primary Interop Assemblies and Microsoft Visual Studio Tools for Office Runtime, and cant work out how to install them.
5:12pm
Well, I finally got the security model to work, albiet I skipped the bit about prerequisites (figured out later 5:49pm) and installed the addon and it said Hello World, amazing, only 6 hours or so, and silly me, I thought that was it, but no, the security model holds more lovely surprises in store. So I start to modify a few settings and reinstall it, and it says, sorry, you cant reinstall, already installed. Ok, so I try to uninstall, sorry you can't uninstall, the security model can't be found. Hmm, I can't install a new copy and I can't uninstall the old copy. Microsoft you guys are playing games with me right?
5:49pm
Prerequsites: If you installed the sample solution from the walkthrough,you will have a directory like "C:\Program files\Microsoft Visual Studio 2005 Tools for Office SE Resources\VSTO2005SE Windows Installer Sample\packages\Office2007PIA" on your harddisk. In this directory the package files for the prerequisites definition files are stored. You will also have a directory like: "C:\Program files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages" Here are the standard Package definition files. If you copy over the directories from the sample to the standard directory -> you will have it here.
Lets see eh... Far out, I'm having a win. Why wouldn't they just say that in the walkthrough? Fkn MS. Oh, part 1, well why didn't they say?
12-June-2008
Ok, I'm at it again this morning. Last night I finally got the addon to load in outlook and output Hello World! But going back though the walkthough I thought I'd try and at least finish off some of the major items such as addin the prerequsites. I found that I'd actually installed the wrong version of the VSTO tools!!! I had the original version, not Version 3 So I couldn't work out why I didn't have half the files like ComponentCheck.cpp!
What are the parameters is in your Custom Install Action
2:15pm
From Forum answer about custom actions In the walkthrough custom actions:
/assemblyName="OutlookAddin.dll" /targetDir="[TARGETDIR]\" /solutionCodeGroupName="MyCompanyName.OutlookAddin" /solutionCodeGroupDescription="Code group for OutlookAddin" /assemblyCodeGroupName="OutlookAddin" /assemblyCodeGroupDescription="Code group for OutlookAddin" /allUsers=[ALLUSERS]
The CodeGroupName is "MyCompanyName.OutlookAddin", make sure to change companyname to your company name!! This whole string must exactly be the same in Install, Rollback and Uninstall actions of your setup project.
Recommend Revo Uninstaller if you have the above problem where you can't install or uninstall.
Limitations of the Setup Project
The default Setup project has several limitations:
* By default, the Setup project does not set the security policy. The add-in assembly and any referenced assemblies must be granted full trust for the add-in to run. You can add a step to the Setup project to configure the security policy, or an administrator can set the appropriate security policy. For more information, see Security Requirements to Run Office Solutions (2003 System).
* By default, the Setup project does not check for, or install, the Visual Studio Tools for Office runtime and the primary interop assembly (PIA) for the Microsoft Office application. If these components are not installed on the end user computer, the add-in will not run. For more information about the prerequisites, see How to: Prepare End User Computers to Run Office Solutions (2003 System).
Yeah right: "Security policy can be easily deployed in a Windows Installer"
Comments