An Introduction To GroupWise Client Custom Development

With GroupWise 2014 there has naturally been a lot of discussion about scripting for the web based administration manager using the new REST api.  The GroupWise client has also been updated with a more modern look and feel but even so the tools to add new features to the client are still available.

So you want to write an add-on to GroupWise, but have no idea where to start.  What I plan to show you in this article is how to write a simple add-on.  In this case I will write it in Visual Basic .NET but other development tools can be used.

There are a number of APIs available in GroupWise.  You maybe familiar with the SOAP interface that is used by WebAccess and the Mobility Service.  However there are others including:

  • REST API, which is used for admin tasks
  • Object API, often used in conjunction with a C3PO
  • Trusted Applications
  • Token API

However the one I will discuss here is for creating a C3PO.  This API has nothing to do with Star Wars; rather its full name stands for Custom Third Party Object.  It will enable you to modify the client interface in a number of ways:

  • Modify menus and add your own custom options
  • Trap actions such as send, for instance so you can check a message before it is sent
  • Set up your own message types, with their own message icon and actions when they are opened
  • Add your own buttons to a tool bar
  • Trap events such as startup and shutdown or message delivery.

So what do we want to change in the GroupWise Client?  One thing I am always frustrated with is when users come back from holiday but accidentally leave their holiday rule running. So if I send a mail to them I get a reply saying that they will be back from holiday yesterday.  So let’s create a new feature for GroupWise to notify users when they start GroupWise that their holiday rule is still active, and even prompt them to disable it!  Believe it or not we can do this by writing fewer than twenty lines of code.

Setting Up Your Development Environment

First download the GroupWise SDK from https://www.novell.com/developer/ndk/.  You can download just the C3PO information, though I would recommend that you download the full GroupWise SDK which can be found towards the bottom of that page.

Extract the SDK and in one of the GWC3PO subdirectories you will find an executable called C3POWizard (...\gwc3po\novell-gwc3po-devel-2012.11.15\gwc3po-FILES\C3POWizard).  This wizard will lead you through a number of questions and will write all the code necessary for the interface changes, which as you can imagine can save a lot of time.

Creating a C3PO Project

Start the C3PO wizard.  Enter the Name and path where you wish the project to be stored and specify that you wish it only to handle events (see figure 1).

31-gw-client-1-dialog1
Figure 1: Setting the C3PO to handle events

As you only selected the event handler you will have an option to specify which events you wish to handle, in this case the Ready event, which is called after GroupWise has loaded.  (Figure 2).  Moving on  you will then be shown a configuration file, which later you can edit and run the C3PO Generator to re-create code without having to go through the Wizard.

31-gw-client-2-dialog2
Figure 2: Specifying the class of event for the C3PO

The next dialog prompts you for the output format you want for the project.  There are a number of different formats available, but I will select VB.NET.

31-gw-client-3-dialog
Figure 3: Selecting the project environment

When you click next you are asked Do you want the Wizard to create a  VB.Net Project that will make an EXE?.  In this instance we will create a. exe project: then close the confirmation dialog.  If needed you could generate a .dll project instead which would work in much the same way.

Developing the project

So now we need to edit the project and add in the code that we need to check if the holiday rule is active.  Open the project in your development environment, in my case Visual Studio.  Depending on your version you may be prompted to go through updating the code to the latest version as the wizard creates it in an older format.

Edit the eventmon.vb file and move to the notify sub.  which should currently read as

31-gw-client-t1-336x177

As you can see by default all it will do is give you a message box on start-up, but this is where we need to put the code that we want to add.

You will need to modify it to read as follows

31-gw-client-t2-333x727

Explaining the code

1.   Set up the variables

Dim GWAccount As Object
Dim GWRules As Object
Dim GWRule As Object
We need to use three variables, GWAccount, GWRules and GWRule that will store the details of the Account we are currently logged in as;  the collection of all the rules and an individual rule.

2.   Get the account

GWAccount = g_C3POManager.ClientState.CurrentAccount

This will get the currently logged in GroupWise account which can be retrieved from the C3PO manager.

3.   We now need to get all the rules that have been defined for that account

 GWRules = GWAccount.Rules

This uses some of the Object API functionality to get the currently defined rules collection and assign it to GWRules.  The account object can return many other objects such as folders, messages, path to the archive, etc.   Have a look in the Object API documentation for a full list of properties.

4.   Now we need to check each rule in turn

For Each GWRule In GWRules

Each iteration will go through each rule in turn assigning it to GWRule.

5.  Check the current rule to see if it is the  Vacation Rule

If GWRule.name = “Vacation Rule” Then

The Rule object has a number of attributes, including the triggers and actions of the rule.  In this case we just check the name.  Have a look in the Object API documentation for a full list of properties.

You could of course extend this statement to check for multiple different rule names.

6.   Check if the Rule is enabled

 If GWRule.enabled = True Then

If the vacation rule is enabled we need to display the prompt.

7.   Display a Dialog

If MsgBox(“Your out of office rule is active – Disable?”,
                MsgBoxStyle.OkCancel) = MsgBoxResult.   
   Ok Then

Let the user click on an OK or cancel button.

8.   If they select OK then disable the rule

GWRule.enabled = False

Not only can you read properties from GroupWise but you can also set many of them.

Installing the C3PO

Once you have made your changes, build your executable, then copy it to your GroupWise program directory. You then need to register your executable so that GroupWise is aware of it.   Run a program called regasm (register assembly) .  You may have a few copies of the program on disk (I had 6!).  Run the latest version that is for 32bit applications, the one I used was in C:\Windows\Microsoft.NET\Framework\v2.0.50727.  Give it the parameter of the executable you have just built:

<path>\regasm.exe <gwpath>\HolidayAlert.exe

Now all that is left is to launch the GroupWise client.  This will recognise that there is a C3PO registered and launch it at the same time.  As we have specified that it hooks into the ‘On ready’ event it should check the rules on start-up. If the vacation rule is enabled it will prompt you to disable it (See Figure 4).

31-gw-client-4-result
Figure 4: The C3PO works!

You can have multiple C3POs running against a GroupWise client should you wish.

I hope that this has shown you just how easy it is to write an add-on to work with the GroupWise client.  For further information do have a look at the documentation in the SDK.

 

This article was forst published in OH Magazine Issue 31, 4/2015, p32-34.

Leave a Reply