1

I have a source list which has the EmployeeIDs of some of the employees and I need to look these up in SharePoint to get other details of the user and enrich the existing list by mapping the EmployeeIDs with their account name so that other details can be pulled out later.

I am able to get all the user properties using a REST get request that looks something like this:

http://companyname.com/site/sitename/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='DOMAIN\USER.NAME'

The EmployeeID is a custom property that is embedded in an array inside "UserProfileProperties" object inside the JSON returned by the above call.

I am looking for a way to query the user profiles to get the specific profile of the user having "EmployeeID" = "XXXXX"

Please leave a comment if you have something in mind which might lead me in some direction.

If nothing works out, then I'll be crawling through the whole hierarchy and creating a mapping of account names and employee IDs.

1
  • Not sure but that custom property might also be returned in the user information list. Can you check if it exists?
    – Akhoy
    Commented Sep 18, 2015 at 15:54

1 Answer 1

1

If you want to find user by custom property you can use People Search. High level steps will be:

  • Create custom property in User Profile.
  • Run full crawl on people result source (this will create Crawled property with name similar to People:EmployeeID.
  • Create managed property in search schema mapped to the crawled property and set Queryable to true. Let's call it people_employeeid for this example.
  • Crawl again.

Call Search REST service on the endpoint:

/_api/search/query?querytext='people_employeeid=test'&sourceId='00000000-0000-0000-0000-000000000000'

In sourceId parameter you should put GUID of people result source in search. You can find IDs of result sets using following PowerShell:

$searchapp = Get-SPServiceApplication | ? TypeName -EQ "Search Service Application" # Name of your search application
$owner = Get-SPEnterpriseSearchOwner -Level Ssa
Get-SPEnterpriseSearchResultSource -SearchApplication $searchapp -Owner $owner | Select Name, Id

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.