We are using people picker (jQuery autocomplete) in a SharePoint Provider hosted app for binding the data of AD users.

We are using predefined web service Interface (ClientPeoplePickerWebServiceInterface) from SharePoint.

In that we are getting only login name,email id, display name etc. but we are not getting user id. We require user id to insert the data into list (people and group field) through REST API.

When we are using the below code we are getting user id using login name(i:0#.w|vf-root\empadmin). It is working to get only SharePoint group users, but it is not working for all users who are in AD or user profile users.

Please help us to get user id or to insert login name (with out using user id) into people and group field.



  • We are unable to use var context = new SP.ClientContext.get_current(); in provider hosted app.
  • We are calling ClientPeoplePickerWebServiceInterface through web method.
  • Using "/_vti_bin/ListData.svc/UserInformationList? $select=Id,Name&$filter=substringof('" + searchKey + "',Name)"; we are only getting site users. We need user ids from user profile
  • Also, is there any possibility to insert user(people and group field) using login name i:0#.w|vf-root\empadmin through rest api (without user id)?
  • UserId is fetched from the user in Site user information list. The user needs to have an entry in that list to get the UserId value
    – Unnie
    Oct 27, 2015 at 8:52

1 Answer 1


I have below solution to get UserId from Login Name using REST API.

http://<site url>/_api/web/sitegroups(<group id>)/users(@v)?@v='<login name>'
http://<site url>/_api/web/siteusers(@v)?@v='<login name>'

here @v have different type of value like

1) i:0#.f|membership|[email protected]


2) i:0#.w|domain\user


3) i:05:t|adfs with roles|[email protected]


Note: keep in mind that while getting user information from Login name first encode claim token and then merge it with login name and then pass it with single quote

For more information see the GetByLoginName method on MSDN.

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.