定制声明提供者 - 结果未显示在人员选择器中
-
28-09-2020 - |
题
我已经实现了定制声明提供者。当我在人员选择器进入一个术语时,它会查询提供程序并返回匹配挑选对象的列表。
调试显示,正确的挑选对象被发送回SharePoint,但人员选择器不会显示它们。但是,它确实显示了一个字符串,说明“显示x结果”,其中x匹配它应该显示的结果数。
我的Fillsearch方法如下:
protected override void FillSearch(Uri context, string[] entityTypes, string searchValue, string hierarchyNodeID, int maxCount, SPProviderHierarchyTree searchTree)
{
// Ensure that People Picker is asking for the type of entity that we
// return; site collection administrator will not return, for example.
if (!EntityTypesContain(entityTypes, SPClaimEntityTypes.FormsRole)) { return; }
List<PickerEntity> matches = new List<PickerEntity>();
/*
removed code that retrieves the matches
*/
searchTree.AddEntities(matches);
}
.
填充匹配列表的代码通过调用以下方法
来实现private PickerEntity GetPickerEntity(string claimValue)
{
PickerEntity pickerEntity = CreatePickerEntity();
pickerEntity.Claim = CreateClaim(BaseClaimType, claimValue, StringClaimValueType);
pickerEntity.Description = ProviderDisplayName + ":" + claimValue;
pickerEntity.DisplayText = claimValue;
pickerEntity.EntityData[PeopleEditorEntityDataKeys.DisplayName] = claimValue;
pickerEntity.EntityType = SPClaimEntityTypes.FormsRole;
pickerEntity.IsResolved = true;
return pickerEntity;
}
.
如何显示结果?
解决方案
这结果是一个激活问题。我注意到,在我的自定义提供程序代码的部署之间,FillClaimTypes和FillClaimValueTypes方法未被调用。
我使用 sp2013claimstools 并重新激活它。ChillClaimtypes和FillClaimValueTypes方法被调用,一切都开始按预期工作。
其他提示
我有你的问题。 它在FillClaimtypes方法上。 从指定的模式URL中有一个错过匹配,以及分配给您的索赔的模式URL。 我已经解决了分配相同的架构URL。 这里有更多详细信息 http://www.lucacodante.com/ITEM/41-Custom-claims-provider-results-not-showing-in-people-picker.html