Help: Outlook Add-In. How do I set the button icon?
-
I have written an add-in for Outlook which adds a button to the toolbar. It works great and now I'm trying to tweak it. I cannot for the life of me figure out how to set the icon next to the text. I've tried several suggestions I've seen on the net to no avail. Keep in mind that there is no form for the plug-in that is loaded until AFTER you press the button. Note: The project is actually written in VB. Why in the world would I post in the C# forum? Because all the good people are now using C#. If you don't know the VB equivalent code, no big deal I can read C# well enough. Also, what distribution files need to be included (other than the 1.1 framework)? It installs great on my two machines running power point 2003 and power point 2000. However, both machiens have the development environment already on them. I sent my manager the .msi and he installed and says the button is not there. So I'm guessing some dependancy is missing. --Tony Archer "I can build it good, fast and cheap. Pick any two."
-
I have written an add-in for Outlook which adds a button to the toolbar. It works great and now I'm trying to tweak it. I cannot for the life of me figure out how to set the icon next to the text. I've tried several suggestions I've seen on the net to no avail. Keep in mind that there is no form for the plug-in that is loaded until AFTER you press the button. Note: The project is actually written in VB. Why in the world would I post in the C# forum? Because all the good people are now using C#. If you don't know the VB equivalent code, no big deal I can read C# well enough. Also, what distribution files need to be included (other than the 1.1 framework)? It installs great on my two machines running power point 2003 and power point 2000. However, both machiens have the development environment already on them. I sent my manager the .msi and he installed and says the button is not there. So I'm guessing some dependancy is missing. --Tony Archer "I can build it good, fast and cheap. Pick any two."
You have to deploy the interop assemblies too, like Microsoft.Office.Interop.Outlook.dll. These need to either be installed into the Global Assembly Cache (GAC) or into the installation directory of your application (or in a sub-directory configured as a probing path). It doesn't matter if your form is loaded or not - your add-in is still loaded otherwise you'd see no command button at all. Also, if you're using Office 2003 Smart Documents and its interop assemblies, you MUST add a code-group to the machine policy that points to your assembly, even if running under the local machine. Office 2003 includes a CLR host that works differently than the executable loader in Windows. Finally, there's plenty of information about Office solutions development in MSDN, such as Custom Button Faces in a Managed Code Add-in for the Microsoft Office System[^]. The same should work for older interop assemblies that work with older versions of Office which almost always work completely with newer versions of Office (it's all about versioning interfaces in COM).
Microsoft MVP, Visual C# My Articles
-
You have to deploy the interop assemblies too, like Microsoft.Office.Interop.Outlook.dll. These need to either be installed into the Global Assembly Cache (GAC) or into the installation directory of your application (or in a sub-directory configured as a probing path). It doesn't matter if your form is loaded or not - your add-in is still loaded otherwise you'd see no command button at all. Also, if you're using Office 2003 Smart Documents and its interop assemblies, you MUST add a code-group to the machine policy that points to your assembly, even if running under the local machine. Office 2003 includes a CLR host that works differently than the executable loader in Windows. Finally, there's plenty of information about Office solutions development in MSDN, such as Custom Button Faces in a Managed Code Add-in for the Microsoft Office System[^]. The same should work for older interop assemblies that work with older versions of Office which almost always work completely with newer versions of Office (it's all about versioning interfaces in COM).
Microsoft MVP, Visual C# My Articles
Heath, You absolutely ROCK! It was actually the C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Office.dll that was missing. I sent it to my boss, he put it into the install dir for the project and POOF everything worked. Guess I have to manually set copy local to true. I would have thought that VS would recognize if something is not a standard Framework file (as VB6 does with com components) Oh well, that won't happen to me again. Reading that article you linked me to now. Looks promising. Thanks! --Tony Archer "I can build it good, fast and cheap. Pick any two."
-
Heath, You absolutely ROCK! It was actually the C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Office.dll that was missing. I sent it to my boss, he put it into the install dir for the project and POOF everything worked. Guess I have to manually set copy local to true. I would have thought that VS would recognize if something is not a standard Framework file (as VB6 does with com components) Oh well, that won't happen to me again. Reading that article you linked me to now. Looks promising. Thanks! --Tony Archer "I can build it good, fast and cheap. Pick any two."
Files like that should actually be installed into the Global Assembly Cache (GAC), though, since they are common to many applications (potentially). The GAC also provides versioning support if a new one is ever installed, so that your application will continue to use the older version (since the new one isn't just copied over it - known as DLL hell) unless you used a publisher policy or assemblyBinding section in the .config file.
Microsoft MVP, Visual C# My Articles