Welcome to MSDN Blogs Sign in | Join | Help

GWS Application: Part 1

Almost ready to write some code to call Groove Web Services now.

My aim is to create an Outlook addin, which reads data from the Groove Forms tool we made earlier;  the tool is a contact directory, and we'll pull those records out of Groove, into a contact-picker UI, and drop them into Outlook as contacts.  (Much later, we'll read and write the same Forms data to a server-based system, using EDB, but this is a good place to start).

First step is to create a generic Outlook addin.  For this, I just followed Dan Crevier's instructions.  Be sure to very carefully follow his instructions about PIAs and the GAC.  (There's more documentation on MSDN, but Dan's code should get you all the way).

There's only one piece of Dan's code I would recommend to change:  I'd been playing around trying to decide whether I want a button (msoControlButton) or a dropdown menu (msoControlPopup with added buttons) on the toolbar, and at one point had a bunch of stray buttons left on the toolbar; so my code is a bit more aggressive in cleanup:

// Create a toolbar button on the standard toolbar that calls ToolbarButton_Click when clicked

try

{

// Delete any existing buttons or popups with our "Add Groove Contact" label.

while( true )

{

CommandBarControl c = (CommandBarControl)commandBars["Standard"].Controls["Add Groove Contact"];

c.Delete(false);

}

}

catch( System.Exception )

{

}

// Create it

this.toolbarButton = (CommandBarButton)commandBars["Standard"].Controls.Add(Microsoft.Office.Core.MsoControlType.msoControlButton, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value);

this.toolbarButton.Caption = "Add Groove Contact";

this.toolbarButton.Tag = "Add Groove Contact Button";

this.toolbarButton.OnAction = "!<MyAddin1.Connect>";

this.toolbarButton.Visible = true;

this.toolbarButton.Style = MsoButtonStyle.msoButtonCaption;

this.toolbarButton.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(this.OnToolbarButtonClick);

Also add a new Windows Form to the project; mine's called Form1, and when the toolbar button is clicked, the form is shown.

private void OnToolbarButtonClick(CommandBarButton cmdBarbutton,ref bool cancel)

{

try

{

// Display the contact picker form

Form1 selectionForm = new Form1();

if( selectionForm.ShowDialog() == System.Windows.Forms.DialogResult.OK )

{

// later

}

}

catch( Exception e )

{

string msg = e.Message + System.Environment.NewLine + System.Environment.NewLine + e.StackTrace;

System.Windows.Forms.MessageBox.Show( msg, "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error );

}

}

Final step for now: add Web references to the Groove WSDL files, so we'll be able to call Groove.   Right-click on "Web References" in the solution explorer; select "Add Web Reference"; enter the path on disk to the GrooveAccounts.wsdl file (C:\Program Files\Groove Networks\Groove Web Services Development Kit\Lib\XMI\2.0\wsdl\GrooveAccounts.wsdl, for example), and add this with a web reference name of "GrooveAccountsWebService".  Then repeat for all the other Groove WSDL files (or at least for the ones we'll use in this project: Accounts, Forms, Spaces, Tools).

Unfortunately, I don't believe there's a shortcut to adding each reference separately.  But you only need to do this once :-)

Build.  (Did that work?  Run Outlook, press the button to see an empty form...)

Next up, a few lines of code to actually call Groove.

Published Monday, July 25, 2005 3:09 PM by hpyle
Filed under:

Comments

# GWS Application: See It Run!

Monday, August 15, 2005 9:59 AM by hughpyle
Having covered the security pre-requisites, we can build an application which actually runs.
In Part...

# Furthur!

Friday, September 09, 2005 3:39 PM by hughpyle
Here's a recap and subject-index of the story so far.

Getting started with Groove Forms; the component...

# Furthur!

Friday, September 09, 2005 3:40 PM by hughpyle
Here's a recap and subject-index of the story so far.

Getting started with Groove Forms; the component...
Anonymous comments are disabled
 
Page view tracker