0

Is there a way through writing code to make changes to the SharePoint Online tenant-level search schema? My goal is to add managed properties and edit existing managed properties to map crawled properties and add aliases.

I am aware of the Microsoft.SharePoint.Client.Search.Portability class and its ability to export and import search configuration however it doesn't meet my needs as it can only import to the site collection and site scopes and not to the tenant search service. As well I have a requirement to run this code in different tenants where the search schema may differ and so I prefer a programmable solution over an import so as to handle these differences.

At this point I am open to any programmable method. CSOM, REST, SharePoint App, SPFx, or anything else.

0

Try using the PnP library of your choice and you should be able to import your settings at the Tenant Level via SearchObjectLevel enumeration.

https://github.com/SharePoint/PnP/tree/master/Samples/Core.SearchSettingsPortability

  • The PnP documentation states: "The methods use the SearchConfigurationPortability and SeachObjectOwner objects and the code executes either the ExportSearchSettings method or ImportSearchSettings method to perform the action requested by the user in the console." This is the class mentioned in my question: "You can also export customized search configuration settings from a Search service application (SSA) and import the settings to site collections and sites; however, you cannot import customized search configuration settings to a Search service application (SSA)." – shufler May 9 '18 at 15:37
0

After a number of avenues and engaging Microsoft support the answer to my original question is no.

Importing search configurations into SharePoint Online is the only supported method of automating this configuration, and because the import can happen only within a site collection I had accept this limitation and apply the configuration in every site collection that needs it.

I created a new site collection and configured the search settings the way I needed them and then exported the configuration which I use for all other installations.

I learned that the Microsoft.SharePoint.Client.Search.Portability class is the programmable interface to the Export and Import search configuration options you see in Site Settings so the XML files are the same no matter which scenario you use. And because the Office PnP modules leverage this API, they use the same XML files.

The only downside to all of this is I cannot automate managed properties that use People crawled properties. These properties are crawled only at the tenant level and since you cannot import search configuration into the tenant you have to configure them manually.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.