Skip to content
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

Dynamic results filtering like in PnP Search? #81

Open
jussihi opened this issue Jan 12, 2024 · 3 comments
Open

Dynamic results filtering like in PnP Search? #81

jussihi opened this issue Jan 12, 2024 · 3 comments

Comments

@jussihi
Copy link

jussihi commented Jan 12, 2024

Suggestion

Hello and first of all: thanks for creating this! Working with Graph is so much easier than with SharePoint search & SharePoint user profiles!!

What I would love to see in this app is a way to filter users by for example their:
Department
Location
Job title

In PnP search this is rather easy; I can simply use the "PnP - Search Filters" web part. Would this be a big trouble implementing here?

So something like this:
image

Here selecting "Sevilla" would only list searched users that are located in Sevilla.

Once again, kudos for creating this 👍

@YannickRe
Copy link
Owner

Hi @jussihi ,

First of all thank you for the sponsoring (and the nice words), very much appreciated!

Now, as to your request: I wish I could build that too, it would be very helpful/useful in a lot of situations. Unfortunately, as far as I know, there is no efficient way to get a list of all distinct field values from Graph. With SharePoint Search, this is easy, as you can request the "refiners" when making a specific query. It will then return all distinct values for a field, like all distinct values for BaseOfficeLocation. Graph does not offer this functionality on the endpoint that we are currently using (/users), but only if we'd switch to using Microsoft Search.
But in that case, you'd probably be better off using PnP Modern Search as it has all that functionality built in.

@jussihi
Copy link
Author

jussihi commented Jan 13, 2024

Hi @jussihi ,

First of all thank you for the sponsoring (and the nice words), very much appreciated!

Now, as to your request: I wish I could build that too, it would be very helpful/useful in a lot of situations. Unfortunately, as far as I know, there is no efficient way to get a list of all distinct field values from Graph. With SharePoint Search, this is easy, as you can request the "refiners" when making a specific query. It will then return all distinct values for a field, like all distinct values for BaseOfficeLocation. Graph does not offer this functionality on the endpoint that we are currently using (/users), but only if we'd switch to using Microsoft Search. But in that case, you'd probably be better off using PnP Modern Search as it has all that functionality built in.

Hmmm... Ok! Thanks for the honest reply @YannickRe .

Would it be possible to even add pre-defined filters? I.e., so that one could predefine possible filter params and their values? So that JobTitles, Departments and Locations.. and whatever the user would like to filter? (and then the graph request under the hood would have the static $filter parameter value appended by JobTitle eq '<chosen predefined value>' ) etc..?

Damn, if I knew TS/JS and SharePoint better, I would already be doing this myself but I'm a complete no-can-do when it comes to web development. SharePoint feels to make it even harder :)

@YannickRe
Copy link
Owner

Theoretically, one could add a config option:

  • Set the field name on the User object to filter against
  • The choice options with displayName and search value
  • The action (equals, greater than, less than, etc) that needs to be used
  • The sorting mechanism

and then add a UI to show these refiners, and when a user clicks one value it would get inserted in the search query.
It's not incredibly difficult to build, but would be a significant time investment...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants