Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

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.

share|improve this answer

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.

share|improve this answer
    
Ok but why I can retrieve a list by its display name in the console but not in a PowerShell script ? –  user1139666 May 21 '13 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 '13 at 8:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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