none
Using SharePoint REST API in provider hosted app to retrieve all users in SharePoint like PeoplePicker RRS feed

  • Question

  • I know how to use the existing PeoplePicker control in SharePoint and that it provides all users to the enduser for selection.

    Is it possible to call SharePoint REST APIs within a Provider Hosted High Trust App. It should be used to retrieve all users which are synchronized from AD with SharePoint to maybe used it in own custom people selector control.

    I have read a lot and tried to find a solution but i read that it will be not possible from inside a High Trust Provider Hosted App to call SharePoint REST API and to authenticate.

    I am a little bit confused and dont know if it will work, and if yes which API i would provide a list of all users. Maybe someone has already experience in that and can help?

    Update

    I have found the following REST API Service:

        /_vti_bin/listdata.svc/UserInformationList


    I have in total >2500 Accounts in my Active Directory which are also correctly synced through the SharePoint User Profile Synchronization Services. When i do a query like this for example:

        http://sp2013/p/RESTAPI/_vti_bin/listdata.svc/UserInformationList?$filter=Account eq 'lab\administratort'&$select=Id,Name


    I get returned the Administrator account cause this account is also added to a Visitors group on that site. But when i query for any other user in Active Directory:

        http://sp2013/p/RESTAPI/_vti_bin/listdata.svc/UserInformationList?$filter=Account eq 'lab\User_aoen_11_sam'&$select=Id,Name


    I dont get any result. Is it correct, that `listdata.svc/UserInformationList` returns only the users from the current site which are actively added to this? And if yes, which other options do i have to get all users like the PeoplePicker already does?


    • Edited by BOG's Lab Sunday, November 27, 2016 11:42 AM
    Friday, November 25, 2016 7:37 PM

Answers