Share-n-dipity

SharePoint serendipity is the effect by which one accidentally discovers something fortunate, especially while looking for something else entirely. In this case, it is the occassional musings, observations, and Ouija board readings about the phabulously

Writing a Custom Claims Provider for SharePoint 2010 - Part 4: Supporting Resolve Name

Writing a Custom Claims Provider for SharePoint 2010 - Part 4: Supporting Resolve Name

  • Comments 4
  • Likes

In the first three parts of this series we've implemented just about all of the support needed to do an end-to-end claims provider.  In this last post I'll describe how to name resolution support in the type-in control.  To add this support we'll need to implement the following property and methods:  SupportsResolve and FillResolve.  Now the good news is that I already covered how to implement SupportsResolve and one of the FillResolve overloads in part 3.  So this posting will be pretty short - here's the implementation for the other overload of FillResolve that was not covered in part 3:

protected override void FillResolve(Uri context, string[] entityTypes,

      string resolveInput,

      List<Microsoft.SharePoint.WebControls.PickerEntity> resolved)

{

 

//make sure picker is asking for the type of entity we

//return; site collection admin won't for example

if (!EntityTypesContain(entityTypes, SPClaimEntityTypes.FormsRole))

      return;

 

//same sort of code as in search to validate we have a match

foreach (string team in ourTeams)

{

      if (team.ToLower() == resolveInput.ToLower())

      {

            //we have a match, create a matching entity

            PickerEntity pe = GetPickerEntity(team);

 

            //add it to the return list of picker entries

            resolved.Add(pe);

       }

}

}

 

If you've been following along then this chunk of code should be completely straightforward.  If it isn't, then read through part 3 again. 

We are now code complete.  If I bring up the type-in control and enter a team name and then click the resolve button, here's what it looks like - first when you type it in, and then after clicking the resolve button:

And with that, we're done.  Hopefully you will find this information useful as you start building out your claims authentication plans.

Comments
Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment