Share via


SPClaimProvider.FillSearch method

When implemented in a derived class, fills search results in People Picker control window.

Namespace:  Microsoft.SharePoint.Administration.Claims
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Protected MustOverride Sub FillSearch ( _
    context As Uri, _
    entityTypes As String(), _
    searchPattern As String, _
    hierarchyNodeID As String, _
    maxCount As Integer, _
    searchTree As SPProviderHierarchyTree _
)
'Usage
Dim context As Uri
Dim entityTypes As String()
Dim searchPattern As String
Dim hierarchyNodeID As String
Dim maxCount As Integer
Dim searchTree As SPProviderHierarchyTree

Me.FillSearch(context, entityTypes, _
    searchPattern, hierarchyNodeID, _
    maxCount, searchTree)
protected abstract void FillSearch(
    Uri context,
    string[] entityTypes,
    string searchPattern,
    string hierarchyNodeID,
    int maxCount,
    SPProviderHierarchyTree searchTree
)

Parameters

  • context
    Type: System.Uri

    The context, as a URI. This must be a properly formatted URI.

  • entityTypes
    Type: []

    The [P:HYPERLINK"mk:@MSITStore:D:\\\\aSDK\\\\SP2010SDK.chm::/html/a4bf54d0-29e5-e5c2-231e-b1b9f4728a7f.htm"Microsoft.SharePoint.WebControls.PickerEntity.EntityType] entity types set to scope the search to.

  • hierarchyNodeID
    Type: System.String

    The unique identifier of the hierarchy node.

  • maxCount
    Type: System.Int32

    A Int32 value that contains the maximum number of providers to be returned in the list.

Remarks

If you want to be able to search for claims in the People Picker control, you must implement this method and **[P:HYPERLINK"ms-help://MS.SPS14SDK.en/SPF14MrefAdmin/html/ba710e89-6180-0fec-fb79-090451f9ee43.htm"Microsoft.SharePoint.Administration.Claims.SupportSearch]**property.

The SupportsSearch must return true.

For demonstration purpose, the search function only supports the full name search. As you can see, the claims provider supports two claims as principal: SalesManager and RegionManager. They can be used them to secure SharePoint objects just like the code example in the FillEntityTypes() reference topic used the ASP.NET roles to do the same thing.

You also must implement the FillResolve() method that takes a SPClaim parameter. This method is used to resolve one single claim to verify the existence of the claim. The People Picker first search the claims using FillSearch() method. Once the user picks one of the claims, the People Picker calls FillResolve() to verify it again.

Sample code provided by: Andy Li, Microsoft Corporation.

Examples


// Returns true if you support claim search in the People Picker control.
public override bool SupportsSearch
{
    get { return true; }
}
protected override void FillSearch(Uri context, string[] entityTypes, string searchPattern, string hierarchyNodeID, int maxCount, SPProviderHierarchyTree searchTree)
        {
            if (searchPattern.ToUpper() == "SALESMANAGER")
            {
                PickerEntity entity = CreatePickerEntity();
                entity.Claim = CreateClaim(CRMClaimType.Role, CRMRoleValue.SalesManager, Microsoft.IdentityModel.Claims.ClaimValueTypes.String);
                entity.Description = CRMRoleValue.SalesManager;
                entity.DisplayText = CRMRoleValue.SalesManager;
                entity.EntityData[PeopleEditorEntityDataKeys.DisplayName] = CRMRoleValue.SalesManager;
                entity.EntityType = SPClaimEntityTypes.FormsRole;
                entity.IsResolved = true;
                searchTree.AddEntity(entity);
            }
            if (searchPattern.ToUpper() == "REGIONMANAGER")
            {
                PickerEntity entity = CreatePickerEntity();
                entity.Claim = CreateClaim(CRMClaimType.Role, CRMRoleValue.RegionManager, Microsoft.IdentityModel.Claims.ClaimValueTypes.String);
                entity.Description = CRMRoleValue.RegionManager;
                entity.DisplayText = CRMRoleValue.RegionManager;
                entity.EntityData[PeopleEditorEntityDataKeys.DisplayName] = CRMRoleValue.RegionManager;
                entity.EntityType = SPClaimEntityTypes.FormsRole;
                entity.IsResolved = true;
                searchTree.AddEntity(entity);
            }
        }

See also

Reference

SPClaimProvider class

SPClaimProvider members

Microsoft.SharePoint.Administration.Claims namespace