Indexing sharepoint lists with ps
-
08-12-2019 - |
Question
I would like to index a column in a list with powershell.
I have a problem, when i retrieve the list how can i set what field should be put to index? Is there a special command, can anyone provide me with example or give me a hint how to implement it.
Thanks
Solution
If I understand correctly you can retrieve field form filed collection of a list and set Indexed property to true
$web = Get-SPWeb http://sharepoint
$spList = $web.Lists["ListName"]
$spField = $spList.Fields["FieldName"]
$spField.Indexed = $true
$spField.Update()
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange