Monday, January 30, 2012

Outlook 2007 Add-in with OTRS

We are using OTRS as ticketing system for support requests, and since it is an internal system only, we wanted to give the opportunity to our employees (requesters) to state their ticket's priority.  The OTRS client interface allows that, but can't add a CC: address, which is wanted by our users, so we decided to try to develop an Office Add-in that would do the job.

I know that we could have used the built-in prorities (Normal, Low, Important) in Outlook, but we wanted 6 levels.  Priorities are important to us because we wanted to have escalation and reports to monitor if the agents are answering and solving tickets in an efficient manner.  So we made 6 SLAs and postmaster filters in OTRS, and the form adds text at the bottom of the message (i.e. SLA=1).  The filter recognizes this text and sets the appropriate header, so the SLA is present in the ticket when it is created.  We also made a GenericAgent job to match the OTRS priority to the SLA of tickets.

First obstacle in the run: The Add-In wouldn't load in Outlook.  The solution: Sign the package.  Not too bad.
Second: There is a limitation in Office 2007 before SP3 that prevents an install of the plugin for all the users (it doesn't allow an Add-in that has registry keys in HKLM to be loaded (If you don't have SP3, there is a hotfix available, see http://blogs.msdn.com/b/vsto/archive/2010/03/08/deploying-your-vsto-add-ins-to-all-users-saurabh-bhatia.aspx).  Fortunately, we now have SP3 everywhere but the fix must be enabled using a registry key. It can't be easy, can it? ;).  Here is the text of the .reg that enables it: 
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Common\General]
"EnableLocalMachineVSTO"=dword:00000001
 
Third: there are prerequisites. First, the Visual Studio Tools for Office Runtime (http://www.microsoft.com/download/en/details.aspx?id=23656) must be installed. It comes as an .exe, so you must run vstor30.exe /x:Extract to extract the content, including its .msi.  I'm  lucky that our Add-in doesn't need the SP1 of VSTOR 3.0 (http://www.microsoft.com/download/en/details.aspx?id=1132) as it comes as an .msp and I don't know how to deploy a .msp in Active Directory.  Second, the Microsoft Office 2007 System Update Redistributable PIA (http://www.microsoft.com/download/en/details.aspx?id=18346) must be installed.  Finally, .NET 3.5 framework must be installed, but it was already on our computers.
Ref: (http://gluegood.blogspot.com/2010/07/namecode-classc-sharp.html).

So, once you have Office 2007 SP3 (or Office 2007 with the hotfix), the .reg is applied, VSTOR and PIA installed, you should be able to install your Add-in.  In our case, it displays a warning asking the user to install or not the Add-In as we haven't found yet what to do to prevent this.

This was how to do it manually, but you'd probably want to deploy using Active Directory.  Here is how I did it:


I have tried deploying in a user GPO, but it didn't work.  The pre-requisites must be installed in a computer GPO, so I decided to put everything in a computer GPO.  I first created a policy object called "LAB Add-In Deploy + Prereq".  I put my lab computer in the security filter and I added 3 software packages (.msi) under Computer Configuration - Software Settings - Software installation.  I created a share with read rights for all authenticated users where I put the .msi packages.  The 3 GPO packages are the VSTO 3.0, the PIAs and the Add-In itself.  Also, I added a startup script in Computer Configuration - Windows Settings - Scripts (Startup/Shudtown) that executes regedit /s on the .reg files to add the needed registry keys.

It is working correctly like this.  When you want to test, you run 'gpupdate /force' on the lab computer, which asks you to reboot, and you answer yes.  Upon reboot, the packages are installed.

What if you want uninstall a package? You right-click on the package, All Tasks, Remove.... You then leave the radio button "Immediately uninstall the software form users and computers" and click OK.  Once the policy has been updated on the computer  (gpupdate /force if needed) and rebooted, the package is uninstalled.

How to upgrade the Add-in? You simply follow the procedure above (uninstall package) and then add a package with the new version.  Once the policy has been updated on the computer  (gpupdate /force if needed) and rebooted, the old package is uninstalled and the new is installed.  Since our Add-in is only 500KB, it is not a problem.  I tried different ways of upgrading (change the .msi, use the upgrade feature in AD (overwriting and not), but this is the only one that really worked for me.

There isn't much documentation on the net about this, so I though it could help a lot of people if I wrote about it.  Feel free to comment if you find mistakes or if you have different experiences with this kind of setup.

Update 1: If you see the add-in twice in Outlook, it is most likely because it is registered twice in the registry: once in HKCU and once in HKLM.

Update 2: If you need to install .NET Framework 3.5 SP1, I suggest you download the full version from here: http://www.microsoft.com/download/en/details.aspx?id=25150
Then, you can install it with a command that looks like this:

psexec  \\computer \\server\path\to\dotnetfx35.exe /q /norestart

Labels:

5 Comments:

At 2:25 PM, Blogger HJoseph said...

Where is the application the actual add in so far you have given us a very good direction how to install the add in.

I would love to test the addin for outlook 2007

 
At 10:08 AM, Blogger ugob said...

Sorry, the add-in will not be available for the public as it is not in english and is customized for our organization. In my post, I wanted to give explanations about how to install it because it is more complex to install and deploy it than to code it. You'd need someone to code in VB to make one for your needs.

 
At 4:55 PM, Blogger dingle15 said...

Would you be willing to at least show us how you connecting to the OTRS API through VB. That's all I'm looking for.

 
At 4:57 PM, Blogger dingle15 said...

Would you be willing to share some of the code? I'm stuck trying to figure out how you connected to the API with VB?

 
At 10:28 PM, Blogger ugob said...

Sorry for the delay, but we did not interact in VB with the API. We just crafted an e-mail message that would contain strings that would be trapped by OTRS postmaster filters.

 

Post a Comment

<< Home