SPClaimProvider.FillSearch 方法

派生类中实现时,将填充人员选取器控件窗口中的搜索结果。

命名空间:  Microsoft.SharePoint.Administration.Claims
程序集:  Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)

语法

声明
Protected MustOverride Sub FillSearch ( _
    context As Uri, _
    entityTypes As String(), _
    searchPattern As String, _
    hierarchyNodeID As String, _
    maxCount As Integer, _
    searchTree As SPProviderHierarchyTree _
)
用法
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
)

参数

  • context
    类型:System.Uri

    上下文,为 URI。这必须是格式正确的 URI。

  • entityTypes
    类型:[]

    **[P:HYPERLINK"mk:@MSITStore:D:\\\\aSDK\\\\SP2010SDK.chm::/html/a4bf54d0-29e5-e5c2-231e-b1b9f4728a7f.htm"Microsoft.SharePoint.WebControls.PickerEntity.EntityType]**实体类型设置为搜索范围。

  • hierarchyNodeID
    类型:System.String

    层次结构节点的唯一标识符。

  • maxCount
    类型:System.Int32

    一个Int32值,其中包含提供程序将返回列表中的最大数目。

备注

如果您想要将能够搜索人员选取器控件中声明的则必须实现此方法, **[P:HYPERLINK"ms-help://MS.SPS14SDK.en/SPF14MrefAdmin/html/ba710e89-6180-0fec-fb79-090451f9ee43.htm"Microsoft.SharePoint.Administration.Claims.SupportSearch]**属性。

SupportsSearch必须返回true。

出于演示目的,搜索功能只支持完整的名称搜索。正如您所看到的则声明提供程序支持两份索赔作为主体: SalesManager 和 RegionManager。它们也可以用它们来保护 SharePoint 对象的**FillEntityTypes()**参考主题中的代码示例使用 ASP.NET 角色可以执行相同的操作一样。

您还必须实现的**FillResolve()方法,采用SPClaim参数。使用此方法来解决一个一个的声明,以验证存在的声明。人员选取器首先搜索使用FillSearch()方法的声明。一旦用户选取一个声明,人员选取器将调用FillResolve()**来进行再次确认。

示例代码提供者:Andy Li,Microsoft Corporation。

示例


// 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);
            }
        }

另请参阅

引用

SPClaimProvider 类

SPClaimProvider 成员

Microsoft.SharePoint.Administration.Claims 命名空间