1

When I call SearchPrincipals to search for a user name, I get back results with a PrincipalType of SecurityGroup instead of User. This is odd since the user should be a.... user.

What are the reasons why this could be happening?

Utility.SearchPrincipals(context, context.Web, "user name", PrincipalType.All, PrincipalSource.All, null, short.MaxValue);

This is an on-premise SharePoint 2013 environment.

2
  • Have you tried PrincipalType.user instead of all?
    – Bunzab
    Commented May 6, 2015 at 11:06
  • I haven't, but I'll try it! Commented May 6, 2015 at 13:40

2 Answers 2

0

Try to specify principal type for search

Utility.SearchPrincipals(context, context.Web, "user name", PrincipalType.User, PrincipalSource.All, null, short.MaxValue);
1
  • Tried specifying PrincipalType.User, but I get no results back. Commented Jun 12, 2015 at 11:04
0

Still happening in other environments, years later...the answer seems to be to use Microsoft.SharePoint.ApplicationPages.ClientPickerQuery.ClientPeoplePickerWebServiceInterface.ClientPeoplePickerResolveUser and then Web.EnsureUser to make sure the user has been added to the site!

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.