Often we have a number of Content Types which inherences from each other:
Often we have a number of Content Types which inherences from each other:
As part of a Document Management or Intranet project I have often been asked to add a new property to the User Profile Properties.
Some of the more common purposes are:
Employee Number
Initials
Team (subdivision of Department)
It seems to be a fairly common request as questions about how to enable searching on those new properties occur often in the PnP Modern Search Web Parts GitHub project.
I have used these links as a reference for making a new User Property searchable:
Both when answering questions and handling issues on the PnP Modern Search GitHub project and in my daytime job as a Senior Solution Architect with Fellowmind I work a lot with both Microsoft and SharePoint Search related issues.
When people report an issue with Microsoft Search or the PnP Modern Search web parts the root cause is often related to either:
When this kind of issues shows up in a Search Results web part or in the Out Of The Box search it is pretty difficult to debug, hence this blog post and the Useful tools when working with Search series on YouTube:
Episode 1 is about Using the SP Editor
Episode 2 is about Using the SP Query Tool
Episode 3 is about Using the Graph Explorer ( planned for week 18, early May)
If you have any ideas about additional tools or methods that would be useful when debugging a search related issue please let me know on twitter
"But why not just use permissions to ensure that only the right group of people can see the content", I hear you say?
Well, in this case the content is visible for everybody, but the business rule is that the content MUST be reviewed at a set interval, and if the content has not been reviewed within this deadline, the end user should not see the content in search anymore.
One option could be to have a workflow that breaks the permissions on the item level once the deadline has been reached, but that option comes with a certain smell of substandard performance and complexity.
The Microsoft Search approach looked less intrusive and gave me some options:
Option A)
I could add a Result Type in the Search and Intelligence Admin center that would "intercept" all items of the specific type (using Content type id or similar property) and only display those items that have been reviewed using the $when clause.
Option B)
I could change the query for the verticals in order to exclude specific content using a subset of KQL (Manage search verticals)
Initially I selected Option A, and use the Search Layout Designer to define the layout, but when the layout was used in the Result Type it had a hard time deciding if the date of the deadline is in the past or the future.
Both blocks below were displayed...but only in the Result Type, in the Search Layout Designer it worked as expected. 😕
Due to this issue, I investigated Option B.
Step one was to get the query right, and using Graph Explorer this was pretty easy:
When I tried to negate the query I found that using the - sign as a shorthand for NOT seems to be a no-go going forward.
Once that query works I just updated the Query for the relevant verticals, in this case only the All vertical.
When working with the PnP Modern Search web parts I am often ask by my customers to tweak the layout of the results.
The Lists Layout seems to be the most popular layout. It looks like this out of the box when searching for documents with some metadata:
Find the code block below in the layout template
<span class="template--listItem--author">
{{#with (split (slot item @root.slots.Author) '|')}}{{[1]}}
{{/with}}
</span>
This section shows the name of the Author. Replace it with this section
<mgt-person
ser-id="{{getUserEmail (slot item @root.slots.Author)}}"
view='threelines'
show-presence="true"
person-card="hover"
avatar-size="large"
/>
</mgt-person>
This rather generic SharePoint list is created by a self-service site provisioning setup, and it shows who is in change of any Site Collection.
On the front page on each of the Site Collections the customer requests that we insert a web part with some basic site information. In this case the People web part is not sufficient as some of the metadatea can change over time, such as e.g. the Site Owner.
The obvious choice is therefore a PnP Modern Search results web part using a query like
Path:https://tcwlv.sharepoint.com/sites/SampleTeamSite/Lists/SiteCreationRequestList* basicProvisioningSiteUrlOWSTEXT:{Site.Url}
(basicProvisioningSiteUrlOWSTEXT is the internal name for the SiteUrl column as seen above)
This will give me the data in the list item having the SiteUrl that is the same as the current Site Collection.
I looked in the People layout and found that the template used to display a person is a pnp-persona template and used it in the custom layout. It looks like this and has not hover card.