Custom Federated Search Web Part Sample

Note

This topic describes functionality that is part of the Infrastructure Update for Microsoft Office Servers. To download the update, see Description of the SharePoint Server 2007 infrastructure update: July 15, 2008.

By using Enterprise Search in Microsoft Office SharePoint Server 2007 to create federated locations, you can include items from content repositories that are not indexed by the search server's crawler. When you create a federated location, you must also specify its authentication type. The federated results Web Parts included with Enterprise Search work as expected only for some authentication types. For others, you must create custom versions of the federated search Web Parts.

Overview

This walkthrough provides instructions about how to create and test a custom federated search results Web Part sample that provides a way for the user to enter their credentials, and then passes those credentials in the search request to the federated location. You must create a custom federated search results Web Part when the federated location is configured to use an authentication type that does not work with the federated search Web Parts included with Enterprise Search.

The following authentication types work with the federated search Web Parts included with Enterprise Search without any additional configuration:

  • Anonymous authentication. No credentials are required.

  • All common authentication types, where the credentials specified in the location configuration are automatically passed to the federated location.

  • Per-user Kerberos authentication, where the browsing user's credentials are automatically passed to the federated location.

Per-User Authentication Types That Require Custom Federated Search Web Parts

The following per-user authentication types do not pass the credentials automatically to the federated location:

  • Basic authentication

  • Digest authentication

  • NTLM authentication

  • Forms authentication

  • Cookie authentication

For authentication to work in these scenarios, you must create custom versions of the federated search Web Parts to request the user's credentials, so that the credentials can be passed in the request to the federated location.

For more information, see Creating a Custom Federated Search Web Part with a Credentials UI.

The sample Web Part described in this walkthrough works for federated locations that are configured to use the following per-user authentication types:

  • Basic authentication

  • Digest authentication

  • NTLM authentication

You can download the complete code for the custom federated search results Web Part sample from the Custom Federated Results Web Part Sample release tab, on the Microsoft Office SharePoint Server 2007 SDK Search Samples resource page of the MSDN Code Gallery.

Prerequisites

To use the custom federated search results Web Part sample, your environment must have the following installed:

  • Microsoft Search Server 2008.

  • A test environment for the sample Web Part, with a federated location configured to use Basic, Digest, or NTLM per-user authentication. To set this up, you could use the federated connector from the Federated Search SQL Server Connector Sample as your federated location, and configure the federated connector's Web site to use NTLM, Digest, or Basic authentication.

  • Microsoft Visual Studio 2008 with Microsoft Visual C# or Microsoft Visual Basic enabled.

Completing the Walkthrough

The following topics walk you through creating the custom federated search results Web Part:

Step 1: Set Up the Project for the Custom Web Part

Step 2: Add the Code for the Custom Web Part

Step 3: Deploy the Custom Web Part

See Also

Reference

FormsCredentials
FederatedResultsWebPart
FederatedResultsDatasource
FederatedResultsDatasourceView
SearchResultsBaseWebPart
SearchResultsBaseDatasource
SearchResultsBaseDatasourceView

Concepts

Creating a Custom Federated Search Web Part with a Credentials UI
Federated Search Overview
Building Custom Enterprise Search Web Parts