Tag sites with the CoveoSiteFilter managed property

SharePoint Online sources have a JSON configuration option that allows you to only index sites that have the CoveoSiteFilter managed property set to a specific value.

This article explains the procedure to create the CoveoSiteFilter managed property and how to tag sites in your SharePoint Online tenant. This procedure is a prerequisite for configuring the JSON configuration parameter in your SharePoint Online source.

Step 1: Install the PnP PowerShell module

Follow the instructions in the PnP PowerShell documentation to install the PnP PowerShell module.

The first time you run the PnP PowerShell module, you need to give it administrative consent to access your SharePoint Online organization.

  1. Run the following cmdlet in a PowerShell console with administrative privileges:

    Connect-PnPOnline -Url <SPO_SITE_URL> -Interactive

    Replace <SPO_SITE_URL> with the URL of a SharePoint Online site you want to tag (for example, https://mytenant.sharepoint.com/sites/mysite).

    This will launch a browser window and prompt you to log into your SharePoint Online organization.

  2. In the browser window, log into your SharePoint Online organization using an account that has administrative privileges.

  3. In the Permissions requested screen, click Consent on behalf of your organization, and then click Accept.

Step 3: Add a custom property to the site property bag

There’s currently no way in the SharePoint Online user interface to add a custom property to a site property bag. This has to be done using the PnP PowerShell module.

Run the following cmdlet in the elevated PowerShell console:

Set-PnPAdaptiveScopeProperty -key coveoSource -value <SOURCE_SPECIFIC_VALUE>

Replace <SOURCE_SPECIFIC_VALUE> with a value that sites indexed in the same SharePoint Online source will share. For example, you might want to replace <SOURCE_SPECIFIC_VALUE> with Canada for all sites that apply to a Canadian audience.

Note

You can verify that the property key and value were properly added to the current site property bag by running the following cmdlet in the elevated PowerShell console:

Get-PnPPropertyBag

Step 4: Index the site

The SharePoint crawling process now needs to index the site to create a tenant-level crawled property named coveoSource. To ensure that your changes are picked up during the next scheduled crawl, you should manually request the reindexing of the site.

  1. On the site, select Settings, and then select Site settings. If you don’t see Site settings, select Site information, and then select View all site settings.

  2. Under Search, click Search and offline availability.

  3. In the Reindex site section, click Reindex site.

  4. A warning appears. Click Reindex site again to confirm.

The content will be reindexed during the next scheduled crawl.

Step 5: Create the CoveoSiteFilter managed property

  1. In your browser, access your SharePoint Online tenant search schema at https://<TENANT>-admin.sharepoint.com/_layouts/15/searchadmin/ta_listcrawledproperties.aspx?level=tenant. Replace <TENANT> with your tenant name.

  2. In the Managed Properties section, click New Managed Property.

    Adding the managed property | Coveo
  3. Configure the new managed property as follows:

    1. Property name: CoveoSiteFilter

      Important

      The SharePoint Online source tagged site indexing option expects the managed property to be named CoveoSiteFilter precisely. Make sure the name is spelled correctly with the same casing.

    2. Type: Text

    3. Main characteristics: Select Searchable, Queryable, Safe (optional), and Token Normalization.

    4. At the bottom of the page, click Add a Mapping.

    5. In the Crawled property selection panel, select the coveoSource property, and then click OK.

      Mapping the crawled property | Coveo
  4. Click OK to save the managed property.

Step 6: Tag other sites with the same custom property value

You can use the PnP PowerShell module Connect-PnPOnline and Set-PnPAdaptiveScopeProperty cmdlets to access and tag as many sites as you want with the coveoSource custom property value you chose.

Note

Being tenant-wide, mapping the coveoSource crawled property to the CoveoSiteFilter managed property only needs to be done once.

Step 7: Configure your SharePoint Online source

Once all sites you want to index in the same SharePoint Online source are tagged, configure your source to target the tagged sites.