none
Pulling all users info within a site collection from Provider Hosted App RRS feed

  • Question

  • Hi,

    How can I pull the information (identity, name, email etc.) of all users within the site collection where the Provider Hosted App is hosted? I want to use autocomplete feature in a text box to select any user from the site collection.

    My application is built on Asp.Net MVC 5 Razor with App Only Policy. The app has full control right to the site collection.

    Thanks in advance.

    Saturday, August 4, 2018 7:19 PM

Answers

  • Hi,

    1. We can add the Dummy module into SharePoint project with Right Click Add New Item:

    2. Yes, we could add multiple picker in a single form by adding the inputbox html:


    PeoplePicker for provider hosted apps

    3. layout page is the default page generate by the project hosted in Views/Shared folder:

    And for another points to check, please make sure the permission for the host web is set properly in AppManifest.xml:

    You could download the complete project from GitHub for a test:

    https://github.com/spkrby/MVCPeoplePicker

    I have tested in my side and it works as expected:

    And other points is to read the user data with Rest API and then use Jquery AutoCompleted plugin bind to the textbox as Hamza's suggestion.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Monday, August 6, 2018 10:07 AM

All replies

  • Hi pointtoshare,

    You could use PnP Core.PeoplePicker to create a custom people picker text box to select user, here is a sample code to implement this in a Provider Hosted app MVC Web Application for your reference:

    People Picker MVC Sample

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Monday, August 6, 2018 7:23 AM
  • Hi Jerry,

    Thank you so much for your response.

    I have tried it in my project earlier but din't work, probably i couldn't configure it well. I had few questions on that-

    > Where and how I add the dummy module?

    > Can I add multiple people picker in a single form?

    > Where do I create the layout page?

    Do you have any sample project where you have used this? 

    And, if I don't want to use this, do you have any idea how I can achieve this the way I described in my question?

    Thanks again.

    Monday, August 6, 2018 8:05 AM
  • Hi,

    You could use the PeoplePicker REST services to implement your own control:

    /_api/SP.UI.ApplicationPages.ClientPeoplePickerWebServiceInterface.clientPeoplePickerSearchUser

    I have not found an MSDN article about this but here's an example:

    https://www.c-sharpcorner.com/blogs/people-picker-field-resolve-in-sharepoint-2013clientpeoplepicker-using-rest

    Monday, August 6, 2018 8:48 AM
  • Hi,

    1. We can add the Dummy module into SharePoint project with Right Click Add New Item:

    2. Yes, we could add multiple picker in a single form by adding the inputbox html:


    PeoplePicker for provider hosted apps

    3. layout page is the default page generate by the project hosted in Views/Shared folder:

    And for another points to check, please make sure the permission for the host web is set properly in AppManifest.xml:

    You could download the complete project from GitHub for a test:

    https://github.com/spkrby/MVCPeoplePicker

    I have tested in my side and it works as expected:

    And other points is to read the user data with Rest API and then use Jquery AutoCompleted plugin bind to the textbox as Hamza's suggestion.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Monday, August 6, 2018 10:07 AM