Creating Groove Web Services Projects in Visual Studio 2008

Applies to: SharePoint Workspace 2010 | Visual Studio 2008

To create a Microsoft Visual Studio 2008 Service Pack 1 project to use 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 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 automatically reads any XSD files referenced by the WSDL files.

The address of the WSDL files on your hard disk depends on where you installed the Groove Web Services SDK.

To create a Visual Studio 2008 project to use a Groove service, follow these steps:

  1. Create a new project by using a template such as the Windows Forms Application for Visual Basic or Visual C#.

  2. Add a reference to the Services() assembly so that you can call Groove Web Services. In Solution Explorer, right-click References, and click Add Reference. Select the System.Web.Services assembly on the .NET tab and then click OK.

  3. Add a reference to the Security() assembly so that you can decrypt the Groove Web Services request key. In Solution Explorer, right-click References and click Add Reference. Select the System.Security assembly on the .NET tab and then click OK.

  4. Add the Web service references to the Groove Web Services that your application will use. The sample code provided in the SDK and the code fragments in this document use the Visual Studio Web Reference, not the newer Service Reference. To get the Add Web Reference window, follow these steps:

    1. In Solution Explorer, right-click References, and click Add Service Reference.

    2. Click Advanced.... This opens the Service Reference Settings window.

    3. Click Add Web Reference.... This opens the Add Web Reference window.

  5. In the Add Web Reference window, enter the disk address of the WSDL file the URL field and then click Go. For example, if you install the SDK in the default folder, the address of the GrooveAccounts.wsdl file is "C:\GrooveWebServices\Groove Web Services SDK\Lib\XMIs\2.0\wsdl\GrooveAccounts.wsdl". The service and methods are displayed in the left window.

  6. Rename the service by replacing the text in the Web reference name field according to the table following this list. For example, when you import a reference to GrooveAccounts.wsdl, rename the service to GrooveAccounts. Although developers can 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.

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

  8. For each Groove Web Service that you will use in your project, repeat steps 4 through 7.

Add reference to Groove Web Services WSDL file

Rename service namespace to the following































The next five steps will enable your project to handle events. You should always include these steps when you are creating a Visual Studio 2008 project for Groove Web Services. If you omit these steps and then 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 that is used in your project. For example, if the namespace of the project that contains your Web references is GEventTest, edit the first line of GrooveEventData.cs from the original:


    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 the project in Solution Explorer, click "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 selected service names different from the recommended names, you will have to edit the service names in these files.

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

In the XML schema definitions in the XSD files, an optional element is indicated by the declaration minOccurs="0". Because C# and Visual Basic .NET do not allow for 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 additional parameter after each optional parameter. This additional parameter is named parameter-nameSpecified. For example, in the GrooveFilesBase64Read operation, the Recursive parameter is optional. If the prototype contains an additional 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 additional Boolean element that is named element-nameSpecified, this determines whether the element is included in the SOAP message.

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

See Also


WSDL, SOAP Messages, and Proxy Code