Search – Inquisitive M365 https://thomasdaly.net Yet another SharePoint / Office 365 blog Fri, 06 Mar 2026 14:51:02 +0000 en-US hourly 1 116451836 Sort Your SharePoint Site Directory Alphabetically https://thomasdaly.net/2025/02/02/sorting-your-sharepoint-site-directory-by-title-with-pnp-search/ https://thomasdaly.net/2025/02/02/sorting-your-sharepoint-site-directory-by-title-with-pnp-search/#comments Sun, 02 Feb 2025 21:53:07 +0000 https://thomasdaly.net/?p=3339 In my previous article, Build a Site Directory with PnP Search Web Parts, I walked through how to create a dynamic site directory using PnP Modern Search. While that setup provides a powerful and flexible way to display SharePoint sites, you may have noticed a limitation—SharePoint doesn’t allow sorting by the Site Title property out of the box.

This article covers the extra step needed to sort your site directory alphabetically by title. The trick? Leveraging RefinableString fields to make the Site Title sortable. It’s a simple process with just a few tweaks, and by the end of this guide, you’ll have a properly sorted site directory in no time. Let’s dive in.

Updating the Search Schema

Navigate to the SharePoint Admin Center

Expand ‘Advanced’ then click ‘More Features’ and finally click ‘Open’ under the ‘Search’ group

Next click ‘Manage Search Schema’

Next enter ‘RefinableString’ in the search box and click the green button

Hover over any of the available properties and find the drop down, then click ‘Edit Map Property’

It’s not critical on what number refinable string you choose

Scroll all the way to the bottom and click ‘Add a Mapping’

Enter ‘display’ and click ‘Find’, then select Basic:displaytitle and click O

Verify the mapped managed property and click ‘OK’

This completed the Search Schema changes. These can take quite some time to take effect so be patient. It could be a day before you see it working.

Next navigate to the SharePoint page with the PnP Search Web Part configured as a Site Directory

NOTE: The following steps are only necessary if you have customized the Custom template.

  1. Edit the page and open the web part properties of the Search Results web part
  2. On the second page, click on the curly braces { }
  3. Take a copy of the entire

Change the template to Debug. This is so that you can visually see the property to ensure that the search property has taken effect.

Go back to the first page of the web part properties, enter the name of the RefinableString## you modified and hit Enter.

The result should appear on the left hand site – most likely it will read null to begin with. It will eventually populate. It can appear at any time but at least wait 8 hours or a full day. Recheck the steps in the search config but at this point there is not much more to do but wait.

What to do if the site title will no show up?

If it’s just not showing for a few sites

  • Update the Site Title of the site. Change it temporarily and then change it back
  • Trigger a reindex on the 1 site

If it’s not showing up for many sites

Recrawling puts strain on the service as a whole so it’s not meant to be run over and over as it can take weeks to finish on very large sites.

After the crawl property appears move on to the next step.

Apply the Sort

Navigate back to the Search web part page and edit the web part properties

Click ‘Edit sort settings’

Type in your RefinableString## into the Field name box, click Default Sort and then click ‘Add and save’

The sorting is now set to alphabetical order from A-Z by default.

Next go to the second page of the web part properties

Set the template back to what it previously was. In our case Custom and then click on the { } to edit the custom template

Copy / Paste in the template, Save and Republish.

The final result should be in order by site title.

Wrap Up

Sorting your SharePoint site directory by title might not be possible out of the box, but with a little creativity—leveraging RefinableString fields—it becomes a straightforward solution. By following these steps, you can ensure your directory is organized in a way that makes finding sites easier for users.

This small but impactful tweak enhances usability and keeps your directory structured exactly how you need it. If you’re already using PnP Search Web Parts, this is a great optimization to implement. Have questions or run into issues? Drop a comment—I’d love to hear how this worked for you!

]]>
https://thomasdaly.net/2025/02/02/sorting-your-sharepoint-site-directory-by-title-with-pnp-search/feed/ 2 3339
Build a Site Directory with PnP Search Web Parts https://thomasdaly.net/2025/01/20/build-a-site-directory-with-pnp-search-web-parts/ https://thomasdaly.net/2025/01/20/build-a-site-directory-with-pnp-search-web-parts/#comments Tue, 21 Jan 2025 04:07:34 +0000 https://thomasdaly.net/?p=3324 This article will demonstrate how PnP Search Web Parts can be used to build a comprehensive Site Directory that not only enhances navigation but also improves the overall user experience by providing a centralized resource for accessing various sites within your organization.

Pre-Requisites

PnP Modern Search – Search Web Parts – v4

From your SharePoint site

Instructions

Create a new Page

Edit the Page

Add the PnP Search Results Web Part

Next click ‘Configure’

Next click ‘SharePoint Search’

Next click ‘Customize’ under ‘Layouts slots’

Add SiteUrl — mapped to SPSiteUrl, click ‘Save’

Edit the Query Template, using this as my base. It will show all ‘Sites’ and not the app catalog or my sites.

contentclass:STS_Site -"{TenantUrl}/sites/contenttypehub" -"{TenantUrl}/sites/appcatalog" -SiteTemplate:SPSPERS

** Thanks Kasper Larsen for the comment and suggestion to use the tokens for more resuability! **

Make sure to hit Apply to save the query.

Scroll down to the Paging Options

For our example we want to show as many sites as possible.

Set the number of items per page to 500

Click ‘Next’ to go to the second page of the property pane

Click ‘Custom’ Template and then {}

Replace this CSS

 /* Insert your CSS overrides here */
       .example-themePrimary a {
            color: {{@root.theme.palette.themePrimary}};
        }

        .site-logo {
            width: 35px;
            margin-right: 10px;
        }

        .icon {
            width: 20px;
            height: 16px;
        }

        ul.template--custom {
            list-style: none;
            padding-left: 5px;
	 columns: 4;
        }

        ul.template--custom li {
            display: flex;
            padding: 8px;
        }
        
        .site-link {
            line-height: 20px;
        }
        
        .site-link > a {
            display: flex;
            align-items: center;
        }
        
        .site-link, .site-link a, .site-link a:visited, .site-link a:hover, .site-link a:link {
            color: #000 !important;
            text-decoration: none;
        }

Next replace the item template

<template id="content">

 {{#> resultTypes item=item}}
                            {{!-- The block below will be used as default item template if no result types matched --}}
                            <li class="site-link">
                                <a href="{{slot item @root.slots.SiteUrl}}">
                                   <img class="site-logo" src="{{slot item @root.slots.SiteUrl}}/_api/siteiconmanager/getsitelogo?type='1'"/>
                                   <span class="site-name">{{slot item @root.slots.Title}}</span>
                                </a>
                            </li>
                        {{/resultTypes}}

                    </template>

Click ‘Save’

Click Republish

Your page should now look something like this

Conclusion

This is the first step toward making a Site Directory with all the sites you have access to. You could easily extend this to use a search box to filter these items down or change the KQL query to show only certain types of sites. You might also notice that the sites are not in order. In the next article I’ll walk you through the process of implementing the sort on the Site Name.

]]>
https://thomasdaly.net/2025/01/20/build-a-site-directory-with-pnp-search-web-parts/feed/ 5 3324
Hiding People from People Search https://thomasdaly.net/2016/01/16/hiding-people-from-people-search/ https://thomasdaly.net/2016/01/16/hiding-people-from-people-search/#comments Sat, 16 Jan 2016 14:45:09 +0000 https://thomasdaly.net/?p=860 Introduction

This all started as a request from a client to hide only certain users from the people search. I’ve decided on this route because the management interface already exists to update user profiles and it would be very little work to add a user profile property, get it crawled and use that as the filter in the people search results webpart. Below I will explain how I was able to accomplish this in Office 365 but the same would work for a SharePoint 2013 on prem.

Update 1/28/2017 – I was able to test and in order for Office 365 search to pick up a newly created user profile property you must set the value of that property in at least 1 user profile. Running the reindex-user.sp1 script located here https://github.com/wobba/SPO-Trigger-Reindex will also ensure that that a full crawl happens (relatively soon somewhere between 0-8hrs possibly?)

Update 1/25/2017 – There have been many comments about Office 365 not picking up the new field. I am still evaluating the exact steps but this takes time. I recently was able to get Office 365 to pickup the custom field last night using https://github.com/wobba/SPO-Trigger-Reindex > reindex-users.ps1 script. I believe that this is what made it happen but i need more time to test.

How To

In Office 365 -> SharePoint Administration -> User Profiles


Click “Manage User Properties” under the People Group


Click “New Property”


Set the following properties (everything else leave be)

Name: HideFromPeopleSearch

Display Name: HideFromPeopleSearch

Policy Setting: Optional

Default Privacy Settings: Everyone

Search Settings -> Alias [checked]

-> Indexed [checked]





Click “OK”

Wait some amount of time for O365 to index the User Profiles and retrieve this new field.

!!! for O365 users !!! – You must set this property on at least 1 user profile before it will be picked up by the crawl. I also recommend running this script ‘reindex-users.ps1’ > https://github.com/wobba/SPO-Trigger-Reindex will also ensure that that a full crawl happens (relatively soon somewhere between 0-8hrs possibly?)

** for on prem users – kick off a FULL search crawl of your people content source**

 

You’ll know it’s ready when you can find the new Property in the Search Schema, Crawled Properties.

From the Admin Center click “search” in the left hand menu


Click “Manage Search Schema”


Click “Crawled Properties”


Enter “Hide” in the Crawled properties search box, then click the green arrow


You will see the property appear in the search results when the property has been successfully crawled.


Next you will need to create a “Managed Property”, Click On the “Managed Properties” link


Click “New Managed Property”


Enter the following information:

Property Name: HideFromPeopleSearch

Type: Text

Queryable: Checked

Retrieveable: Checked

Add Property Mapping -> People:HideFromPeopleSearch





Click Add A Mapping

Enter “Hide” in the search box, click the Find button


Select “People:HideFromPeopleSearch”, click the OK button


Leave all the other properties as-is, click OK


You will now have to wait until Office 365 runs a full crawl on your site for the property to become available in search. When this action takes place is unknown. (I’ve head 4 hours)

** for on prem users – kick off a FULL search crawl of your site content source**

Next go to the people search page

Edit the page and Edit the Web Part Properties of the People Search Core Results


Click Change Query


In the Property Filter drop down select –Show all managed properties–


Select HideFromPeopleSearch


Select “Not equals” then “Manual Value”

Enter “True” for the Manual Value

Next Click Add property filter


Click OK


Click OK in the People Search Core Results, Web Part Properties pane


Save, Check-In & Publish your page – All Set!

To manage users it’s as easy as using the User Profile Service Application, searching for a user’s profile and checking a box to save. Watch the video if you are note sure about that – http://screencast.com/t/5VGSLCt5N

Remember it won’t be instantly removed – it will take a crawl of the people source for those changes to make it to the site!!!

]]>
https://thomasdaly.net/2016/01/16/hiding-people-from-people-search/feed/ 27 860