-
Notifications
You must be signed in to change notification settings - Fork 536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter WebPart "People Directory" #246
Comments
I'd like to request this as well. We have admin accounts and service accounts and hidden terminated employees who show up no matter what. Looks unprofessional and I can't really use this webpart until we can filter. Appreciate you making it and can't wait for an update. Thank you, |
I've had the same issue but with the out of the box people search. For this webpart I think the best thing would be to create a bespoke Result Source where you add your exclusions to the query editor (for example only show users who have a department). However, this would then provide a different experience to the out of the box search results. Microsoft now provide a mechanism to exclude certain AD synced accounts from all 365 search but it's a bit messy and you basically have to hide them from the Address list via an AD attribute. https://techcommunity.microsoft.com/t5/SharePoint-Support-Blog/Exclude-Users-From-Delve-and-SharePoint-Online-People-Search/ba-p/170731 |
mag210, if this webapp could be modified to exclude the SPS-HideFromAddressLists items, that would be great. |
@bazookadaver could you already test mag210's link and check if it works? thanks. |
@bazookadaver, you don't need to modify the webpart, if you follow the MS guide through you will hide that user from all of O365 including any SP search. We use it to hide our admin accounts which we don't want to appear in any 365 search, including delve. As I've said the other approach is to create a custom result source in SP and point the webpart at this. However, if you do this, it will only be the webpart that hides the accounts. I think a more holistic solution (depending on your requirements) is to exclude the accounts you want from 365 as a whole? Note this solution only works with synced AD accounts. |
I haven't been able to test yet, but will let you know. Appreciate the feedback. |
I have this same issue where I have ex-employees showing up as well as admin/service accounts. I actually took the People Directory web part out of the solution and packaged it into its own solution so I can individually add it as required. Anyways, for this, you can update the REST query in the PeopleDirectory.tsx. You can add a refinementfilter to refine the results you return from the query. This flag syncs with the User Profiles on SharePoint with the property SPS-HideFromAddressLists. You can add this in flag in the Refinement Filter for the REST api call. For example:
So I only search for accounts that have a work email address and the flag is not set. |
That's a good solution for this webpart, its' just a shame that we can't amend the modern search query for the whole of 365, as your users will still show up in searches in portal.office.com and SP org searches. Hiding from the address list is a good partial solution but only works for synced on prem accounts |
One of the issues I am having is to filter out Service accounts, or accounts that dont have anything in one of the attributes (eg Job Title is null). I tried doing a compound refinementFilter
But I am not sure if we can use the query to filter out Null values. I have spent quite a bit of time searching online to see if FQL allowed for this, but I cannot seem to find an answer. Does anyone know if something like this is possible? |
You unfortunately can't "filter" out null values, because you can't search against something that doesn't exist. The only way you'd do that is to search for items that do contain values using a bunch of concatenated ORs in the search query. |
Ahh yes. I did come across that as a suggested solution. I think I can do some array manipulation after getting the result set. It wont be as efficient as filtering out in the query itself, but we have a small enough dataset so it should not cause as much overhead.. |
I would like to filter out B2B user accounts |
I managed to achieve this, albeit not using the search query. I had to filter my results array and remove any entries that didnt have a "job title".
That worked for me. |
It looks like this question may have been answered. Is it okay to close this ticket, or are you still looking for feedback? |
Closing issue as "answered". If you encounter similar issue(s), please open up a NEW issue. Thank you. |
@elpinto007 Can you please let me know where did you add people = people.filter(function(Person){ if(Person.jobTitle) return Person; }); it in the file? Can you please send me your complete package of files? |
Category
Expected or Desired Behavior
Is there a way to filter the people you see in the webpart "People Directory" so that only specific users are shown?
For example, using an attribute of the AD account?
Observed Behavior
All users are displayed.
Thanks!
The text was updated successfully, but these errors were encountered: