User photo in Global Search
Would it be somehow possible to add the photo of a user from Active Directory or Exchange Online (or any other photo, which could be selected via an API) to the Global Search, when searching for a User?
If not, is it possible to add that with some custom js code?
Best Answer
-
Jeff_Lang Customer Ninja IT Monkey ✭✭✭✭
Technically this could be done with some JS code, but this would most likely cause performance issues as it looks up photo's for any returned users as you type the names in.
one way to do it would be to add an observer or a function for DOM Inserted, to check for Div's that get created with the Classes "k-master-row Cached_MT_System_Domain_User" each 2nd one also contains the class k-alt.
once on e of the divs with the classes above is inserted/observed you would then need to check for text under it, which depends on what you have setup to display when a user is found. eg for our setup we would look for a div within the above that has "results-details-title DisplayName XXXXXXX" as the class, where XXXXXXXX is the Display Name of the user without spaces. may be worth putting the user name to be displayed when searching so something more unique can be used to find the image to display.
You could then use what text is found in the above to do a search for the image or link to if a url, and insert the HTML into the location you want under the original div with the original DIV with the "k-master-row Cached_MT_System_Domain_User" class..
Due to everyone having their own setups for what is displayed in the Global Search, and different locations to get images from, there is not any simple way to make some generic JS to be able to do this, as it will have to be site specific
0
Answers
Technically this could be done with some JS code, but this would most likely cause performance issues as it looks up photo's for any returned users as you type the names in.
one way to do it would be to add an observer or a function for DOM Inserted, to check for Div's that get created with the Classes "k-master-row Cached_MT_System_Domain_User" each 2nd one also contains the class k-alt.
once on e of the divs with the classes above is inserted/observed you would then need to check for text under it, which depends on what you have setup to display when a user is found. eg for our setup we would look for a div within the above that has "results-details-title DisplayName XXXXXXX" as the class, where XXXXXXXX is the Display Name of the user without spaces. may be worth putting the user name to be displayed when searching so something more unique can be used to find the image to display.
You could then use what text is found in the above to do a search for the image or link to if a url, and insert the HTML into the location you want under the original div with the original DIV with the "k-master-row Cached_MT_System_Domain_User" class..
Due to everyone having their own setups for what is displayed in the Global Search, and different locations to get images from, there is not any simple way to make some generic JS to be able to do this, as it will have to be site specific
@Jeff_Lang
thanks for the reply - Performance concerns was the first thing what I thought about,when I heard that idea ;)
It comes from my manager...And I misunderstood it - He wants it inside the user object, what is a good idea IMO.