3

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

6

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()
| improve this answer | |
  • why you say spTextField.Update? what is spTextFIeld? – Shkipper Mar 28 '12 at 13:20
  • sorry, I did mistake. I updated my unswer ) – Alexander Mar 28 '12 at 13:22
  • Hi, Is it possible to make attachments column in a list "NOT indexable"? if yes can you please post a script? including getting reference to that list. – Varun Verma Dec 19 '13 at 6:41

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.