Nov 24 2017 01:12 AM
Nov 24 2017 01:12 AM
I want to do a scripted site-collection provisioning. So I create everything by script, like:
- Managed metadata
- Crawled properties
- Managed properties
- Content types
It looks like I am facing a challenge creating managed properties. This is what I do:
- I create custom content types
- add the to a list
I assume the crawled properties are generated by SharePoint but they are not.
It looks like they are only generated when I add an item to the list.
Only then they appear in the crawled properties. After that I can create Managed properties.
Am I right? Or do I miss something here?
If so, is there some kind of workaround?
Nov 24 2017 01:14 AMSolution
HI @Mike Jansen,
Yes that is right. As a workaround I quite often provisioned a test list with al of my columns included and then create one list item through my provisioning scripts.
Nov 24 2017 01:17 AM
Hi @Pieter Veenstra,
That's a quick answer ;) Thanks.
In case of SharePoint online, you wait for 24 hours so the crawl ran?
Nov 24 2017 01:19 AM
Hi @Mike Jansen,
Continuous crawl seems to do the job, sometimes it would fail though. Then forcing the updated crawls by going to the list's advanced settings and force the re-index works.
Nov 24 2017 01:29 AM
I try to script the whole provisioning so want to avoid any manual actions. Maybe I can script the re-index. I'll do some testing.
Nov 24 2017 01:35 AM
You can script the reindex using @Mikael Svenson script:
Nov 24 2017 05:19 AM - edited Nov 24 2017 05:19 AM
I'm working with the PnP powershell. Looks like this does the same:
Nov 24 2017 05:23 AM
One additional question though.
I try to put everything into one script. So after the "Request-PnPReindexWeb" or "Request-PnPReindexList" I need to pause the script to wait for the incremental crawl to finish.
What would be a safe margin? 5 minutes?
Nov 28 2017 02:28 PM
The straight answer is that here isn't a safe margin. By default continuous crawls run every 15 minutes so it is theoretically possible for the update to take 29 minutes, if you were just too late.
Nov 28 2017 11:31 PM
As I would do a provisioning of an initial site collection it will not be a problem to wait for half an hour. I just take the safe margin.