How to: Add a Web Reference to the Query Web Service

SharePoint 2010

Last modified: April 20, 2010

Applies to: SharePoint Server 2010

When using Microsoft Visual Studio to create a client application, you can access the Web methods of the Query Web service by adding a Web reference to your client application project. When you add a Web reference for a Web service to your project, Visual Studio generates a proxy class that enables you to call the Web methods in the Web service.

Note Note

Client application in this context refers to an application that calls the Web service, such as a Microsoft ASP.NET Web application or a Windows Forms application.

To add a Web reference to the Query Web service

  1. In Solution Explorer, right-click the name of your project, and then click Add Service Reference.

  2. In the Add Service Reference dialog box, click Advanced.

  3. In the Service Reference Settings dialog box, click Add Web Reference.

  4. In the Add Web Reference dialog box, type http://SERVER/_vti_bin/search.asmx in the URL text field, replacing SERVER with the URL to the SharePoint site. Then, click Go.

  5. When the Web service is located, the page for QueryService Web service is displayed in the main window of the Add Web Reference dialog box. Type QueryWebServiceProxy in the Web reference name field, and then click Add Reference.

Show: