Sp-dev-fx-controls-react: People Picker is searching users only from current site and not entire active directory

Created on 14 Jul 2018  路  33Comments  路  Source: pnp/sp-dev-fx-controls-react

I have noticed that people picker is searching users present in current site only . It should fetch all users in active directory
<PeoplePicker context={this.props.pageContext} titleText="People Picker" personSelectionLimit={1} groupName={''}// Leave this blank in case you want to filter from all users showtooltip={true} isRequired={false} tooltipMessage={"Search for people"} selectedItems={this._getPeoplePickerItems} />

Author Feedback no-recent-activity

All 33 comments

@harshdamaniahd , I suppose we could add another property or option for groupName to allow search all Active Directory users (or SharePoint User Profiles or Graph to simplify it).

Currently the scope of the people picker is set to use the site users and not Global user profiles. The idea of doing that is that the control fetches validated users of the site. Is there a particular scenario for using AD or User Profiles? Would love to know the reason of the usage before coming up with a technical plan.

@AsishP
For now there are two use cases,

  1. There is an intranet landing page, which has an option to search user. So it's great to use this control as when you type you can see the user.Once selected you can click on search icon , which redirects to delve page giving information about the user selected.
    2.There is custom form which basically has columns like approvers ( here we require this control).

At least for now

@harshdamaniahd , I suppose scenario 2 is a perfect fit for this control where approvers will be users of the site mostly I think. Please let me know otherwise.

However, in my opinion, the control was not build to handle scenario 1. We are working on a similar scope in #23 (New Search Control) but haven't made much progress on it recently. I could add People search to the existing scope of the search control. Will that work?

@AsishP Thanks.
Actually it took me some time to think and I have some questions (My understanding)
In case we are using people picker and permission is managed via Office 365 groups, then in that case the user will never be shown up in results.So i guess the scope of PeoplePicker becomes very limited.Generally a people picker searches all users .

Talking about Search Control , so search will take place only for users and no other content just like people picker right ?
Yeh..this seems okay as well

But then its better to segregate content search and people search.
This is what I feel.But definitely you guys may have a better understanding.

My only requirement is that user can enter name and it will return result just like people picker :-)

@AsishP so any thoughts ?

@harshdamaniahd, sorry have been busy lately. Yeah, I agree with your points.

Agreed that people picker should search within Office 365 Unified groups. The implemementation will use Graph so have to plan for it. Will update on it as soon as have got some progress.

Regarding Search, yes the search box will have option on it or properties pane, haven't gave it much thought yet. Also, the results will differ as people results will have more profile information. Will keep you posted on progress and get feedback on the same.

Thanks for the update @AsishP
Great , looking forward for this functionality to come 馃憤

any timelines on this :-)

@harshdamaniahd, sorry have been caught up with some project work recently. Will try to get onto this as soon as possible. The Unified Group might be quicker. The Search part is going to take some time. Will let you know as soon as get some progress.

When 1.6 of SPFx comes out I would like to see this search users from the microsoft graph using the MSGraphClient.
Should be any day now.

Any update on this?

We're dealing with the same situation where we need to search a different site.

If we're calling this a PeoplePicker, it seems to me it should work as much like an out of the box PeoplePicker as possible, returning ALL users and groups which match what's been typed.

@sympmarc, yeah the control was initially created to act as a form control in forms such as list edit forms which scopes to SharePoint site only (don鈥檛 know if this has changed in Modern now). But many are looking for this extension so might add a choice to search across all tenant users along with site users. Thinking of a property like serachscope with choice of site and tenant. Thoughts?

@AsishP I can't recall a time when it's ever been scoped to only the site in modern. PeoplePickers have always scoped to the universe of people unless you set it differently in the list column settings. Since it's the same settings page as we get with classic, it's worked this way consistently for years, unless I'm missing something.

image

@sympmarc, my bad, I see it, bet I never paid attention to it. Yeah then, the control should extended to include all Tenant users as the OOB control setting is.

Then we agree! I tried using this control, and it doesn't really make the cut right now. I'll be stuck until it does.

Yeah agree on the implementation, however don鈥檛 have a endpoint in mind yet. Currently using siteusers rest api endpoint, might have to switch to a userprofile endpoint or graph endpoint (for graph might need some additional settings). So will take some time.

For a workaround, haven鈥檛 tested this yet and if it is feasible, could you please try adding everyone to visitors group and see if that works.

@AsishP - I added Everyone but external users to the Site visitors group, but no joy. Nice thought, though.

It seems like this probably has been thought out before. Let me see if I can dig up ideas on the right endpoint.

Take a look at ngOfficeUIFabric. We've used that in the past, and it works great.

Thanks @sympmarc for trying the workaround, was a long shot anyways, thought will get lucky in fooling SP :)
Also, thanks for the reference to ngOfficeUIFabric, seems like it is using people search, which could work too but then will have to change the people binding from initial load method, to refresh at key change or state change which could then pull the latest and bind it. Might have to work on the flow for this and might some time equally. Will keep you posted on this. Sorry for any delay.

Also, the PropertyFieldPeoplePicker control must be basically identical in intent? Seems like building them separately doesn't make much sense.

@sympmarc, agreed, will look into that part too, might have to take guidance from @estruyf on property people picker. Actually, the peoplepicker control didin't exactly start with the same code base as property pane peoplepicker has but saying that, completely agree that they should have the same identical behaviours and logic. Will work on it.

@AsishP, just wondering if we're going to have the change (to search all users) completed in next 10-15 days? I ask because it impacts the code changes at my end.

@ManiKum, yeah it should be ready in PR soon. Ironing some final functionality implementation with default users and resolving some final bugs. After that as soon as it is merged it will be ready for use.

@sympmarc , @ManiKum , this is now in PR. Please test the control when it is ready in beta after @estruyf merges the changes.

@sympmarc , @ManiKum @harshdamaniahd, forgot to add few key points as below.

  1. The Site users are prepopulated by default, so the users could still choose from them
  2. If not, search will pull more data after entering 3 characters of the user name similar to OOB People picker control.
  3. Have added a delay of 1 sec to allow the search results to return when resolving suggestions. I am trying to find a way to show a spinner for this wait but not ready yet (will submit another PR later if already merged)

@tsekityam, @Arknev , could you please test this on your tenancy with large user sets to pull users which are not site users. If the resolve suggestions doesn't happen within the default 1 sec delay Please use resolveDelay (in millisecs) to add more delay if needed.

@AsishP I just stumbled upon this issue since I was facing the same problem. I've updated to the latest version of the control and can confirm that it seems to correctly pull users across the tenant now. Thanks a lot for the update!

@estruyf Is this fixed?

@ravick4u I was involved above and I believe it鈥檚 been fixed for a long time. Are you having issues?

@sympmarc Last when I tried didn't work for me. I also saw this issue open so I thought of checking on this.

Hi @ravick4u,

Could you please re-check if it still doesn't work for you?

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within next 7 days of this comment. Thank you for your contributions to SharePoint Developer activities.

Closing issue due no response from original author. If this issue is still occurring, please open a new issue with additional details. Notice that if you have included another related issue as additional comment on this, please open that also as separate issue, so that we can track it independently.

Was this page helpful?
0 / 5 - 0 ratings