1

I have implemented a custom claims provider. When I enter a term into the people picker, it queries the provider and returns a list of matching PickerEntity objects.

Debugging shows that the correct number of PickerEntity objects are getting sent back to SharePoint but the people picker doesn't display them. It does however show a string stating 'Showing x results' where x matches the number of results it should display.

My FillSearch method is as follows:

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

The code that populates the list of matches does so by calling the following method

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

How can I have it display the results?

Image showing people picker after custom provider is queried

2 Answers 2

0

This turned out to be an activation issue. I noticed that between deployments of my custom provider code, the FillClaimTypes and FillClaimValueTypes methods were not getting called.

I deactivated the custom provider using the SP2013ClaimsTools and reactivated it. The FillClaimTypes and FillClaimValueTypes methods were called and everything started working as expected.

0

I had your same problem. It was on the FillClaimTypes method. There is a miss-match from the schema url specified into the method and the schema url assigned to your claim. I've resolved assigning the same schema URL. Here for more details http://www.lucacostante.com/item/41-custom-claims-provider-results-not-showing-in-people-picker.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.