SOLVED

PnP powershell > Howto create or edit a managed property?

Iron Contributor

I try to create a provisioning solution using PnP powershell.

I'm a bit stuck at the moment. I try to create a managed property (or edit the default managed properties, like RefinableString etc.) but I cannot find a PnP command to do that. 

 

What commands should I use to achieve this?

 

Thanks, Mike

7 Replies

Hi Mike,

 

You can use the default SharePoint feature to do this:

- Setup your search configuration via the SharePoint interface (refinable properties, custom MP, etc.)

- Export as XML (via the UI or using the PnP cmdlet Get-PnPSearchConfiguration)

- Import your configuration via the PnP cmdlet Set‑PnPSearchConfiguration in an other site collection.

 

Note: don't even try to update the XML file by yourself ;).

 

 

@Franck Cornu Hmmm, that is just what I wanted to do, update the xml...

There is no way to do that?

Why you would like to do this? Just create your MP using the SharePoint UI and then export your schema. Your new MP will be present in your XML file, no need to do any additional configurations here.

If I would like to add one managed property I prefer not to export and import all managed search settings but only the one that is changed. Or does the import some kind of check? If an item exist, than skip the import of the item?

 

Edit: I found this one: https://gallery.technet.microsoft.com/office/Powershell-script-to-250c5aa6

Haven't test it yet but I'll give it a try

best response confirmed by Mike Jansen (Iron Contributor)
Solution

If I remember correctly, SharePoint will import only changes from the default schema. You can verify easily this behavior. I've used this technique several times with no issues so I suggest you to use the supported method rather than a custom script. 

Before we run this command which site collection we need to connect. I would like to export all managed property which I have created in Admin Site. 

 

Did not received managed property when I am running this command against SharePoint admin sites as well as other sites.

ravick4u @hotmail.com I think there is no cmdlet at the tenant level. Anyway, you can export/import the schema directly using the UI (Manage search schema in the SharePoint central admin portal).

1 best response

Accepted Solutions
best response confirmed by Mike Jansen (Iron Contributor)
Solution

If I remember correctly, SharePoint will import only changes from the default schema. You can verify easily this behavior. I've used this technique several times with no issues so I suggest you to use the supported method rather than a custom script. 

View solution in original post