0

I am replacing a colleague for the support of a SharePoint 2010 intranet.
In PowerShell console : I can retrieve a list by its display name from the Lists collection of a SPWeb object.
In a PowerShell script : I can only retrieve a list by its integer index from the Lists collection of a SPWeb object. Why ?

Any help will be greatly appreciated

2 Answers 2

1

I have solved my issue.
My list's display name contains the following character : é
I have changed the encoding of my PowerShell script to UTF8.
Now I can retrieve my list by its display name.

0

I believe you will have to retrieve a List by it's internal name, not the display name. Especially if the display name consists of two or more words. This is, at least, case with List items.

Examples on how to change list settings using PS script can be found on http://get-spscripts.com/ - Part 1 and Part 2, where the author uses list's name to manipulate it.

An example of a PowerShell script for getting items from a list can be found here on Robert Kuzma's blog.

2
  • Ok but why I can retrieve a list by its display name in the console but not in a PowerShell script ? May 21, 2013 at 8:38
  • Are you managing to retrieve a list by name in any case in a PS script? Did you try to get a list by name following the tutorial from the first link?
    – dzookatz
    May 21, 2013 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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