Creating Groove Web Services Projects in Visual Studio 2005

To create a Microsoft Visual Studio® 2005 project to consume Groove Web Services, you must add references to the Groove Web Services WSDL (Web Services Description Language) files. When you add these Web References to your project, Visual Studio 2005 runs a utility that reads the WSDL files and generates proxy code in your project. You specify WSDL files that are present on your disk drive. Visual Studio 2005 automatically reads any XSD files referenced by the WSDL files.

The address of the WSDL files on your hard disk is dependent on where you installed the Microsoft Office Groove 2007 Software Developers Kit (SDK). See the SDK Release Notes for information on the default location of the WSDL files.

To create a Visual Studio 2005 project to consume a Groove service, follow these steps:

  1. Create a new project using a template such as the Windows Application for Microsoft Visual Basic® 2005 or Visual C#® 2005.

  2. In the Solution Explorer, right-click on References, and select Add Web Reference.

  3. Enter the disk address of the WSDL file you want in the Address window and then click on the Go button. The XML source of the WSDL file is displayed in the left window, and the form should show that the service was the only service found at this URL.

  4. Rename the service from the default name according to the table following this list. For example, when you import a reference to GrooveAccounts.wsdl, name the service GrooveAccounts. Although it is possible to use different names, you should use the same names as the services themselves. If you use different names for the services, you must modify the service names in the sample code fragments in this document before you can include them in your project.

  5. Click Add Reference. The reference now should be listed in the Solution Explorer under the Web References node.

  6. Repeat steps 2 through 5 for each Groove Web Service you want to use in your project.

The next four steps will enable your project to handle events. You should always include these steps when you are creating a Visual Studio 2005 project for Groove Web Services. If you omit these steps and later add code for events to your application, you will get SOAP exceptions when you try to read any event classes that are defined by these steps.

  1. Create a copy of GrooveEventData.cs or GrooveEventData.vb, which are provided in Lib\DotNET\GrooveEvents.

  2. If you are creating a C# project, edit the copy of GrooveEventData.cs to specify the namespace used in your project. For example, if the namespace of the project containing your Web references is GEventTest, edit the first line of GrooveEventData.cs from the original:

    namespace YOUR_APPLICATION_NAMESPACE_HERE.GrooveEvents 
    

    to the following:

    namespace GEventTest.GrooveEvents 
    
  3. If your C# solution has more than one namespace, you should ensure that all Web references use the same namespace, and that your GrooveEventData file references that namespace.

  4. If you did not include all services in your project, you should edit the copy of GrooveEventData.cs or GrooveEventData.vb to remove any references to events from the omitted services. If you are creating a C# project and did not name your services in Step 4 using the recommended names, you must edit the copy of GrooveEventData.cs to replace the recommended names with the names that you used.

  5. Add GrooveEventData.vb or the edited GrooveEventData.cs to your project by right-clicking on the project in the Solution Explorer, selecting "Add existing item", and browsing to the file.

The GrooveEventData.vb and GrooveEventData.cs files assume that you have included references to all Groove Web Services in your project and have renamed the services to the names recommended in the following table. If you have not included references to all Groove Web Services or have chosen service names different from the recommended ones, you will have to edit the service names in these files.

Add reference to Groove Web Services WSDL file Rename service to the following name

GrooveAccounts.wsdl

GrooveAccounts

GrooveApplication.wsdl

GrooveApplication

GrooveCalendar.wsdl

GrooveCalendar

GrooveContacts.wsdl

GrooveContacts

GrooveEvents.wsdl

GrooveEvents

GrooveFilesBase64.wsdl

GrooveFilesBase64

GrooveForms2.wsdl

GrooveForms2

GrooveForms.wsdl

GrooveForms

GrooveLocal.wsdl

GrooveLocal

GrooveMembers.wsdl

GrooveMembers

GrooveMessages.wsdl

GrooveMessages

GrooveProperties.wsdl

GrooveProperties

GrooveSpaces.wsdl

GrooveSpaces

GrooveSubscriptions.wsdl

GrooveSubscriptions

GrooveTools.wsdl

GrooveTools

GrooveVCard.wsdl

GrooveVCard

Using Optional Parameters for Groove Web Services in Visual Studio 2005 Projects

In the XML schema definitions in the XSD files, an optional element is indicated by the declaration minOccurs="0". Since C# and Visual Basic .NET do not allow optional parameters, the proxy code has a convention to handle these optional elements. The function prototype defining the proxy code for the operation can contain an extra parameter after each optional parameter. This extra parameter is named parameter-nameSpecified. For example, in the GrooveFilesRead operation, the Recursive parameter is optional. If the prototype contains an extra Boolean parameter named RecursiveSpecified, the proxy code includes the Recursive parameter in the SOAP request if RecursiveSpecified is true, but excludes it if RecursiveSpecified is false.

The proxy code uses the same convention when an element in a structure is optional. If the structure contains an extra Boolean element, named element-nameSpecified, then this determines whether the element is included in the SOAP message.

If an operation has multiple optional parameters, you should explicitly specify all of them because of a restriction in the way Groove Web Services handle optional parameters.

See Also

Concepts

WSDL, SOAP Messages, and Proxy Code