Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Change List name with powershell.

$
0
0

Hello,

I want to create a list with a short name for the url, and rename it to the normal name for the users. But i can't.

if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)
{
    Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
write-host "Type URL"
$site = read-host
$spWeb = Get-Spweb $site


$listName = "TheLongNameOfTheList"
$ShortListName = "shortnm"

       $listTemplate = [microsoft.sharepoint.SPListTemplateType]::Genericlist
        $spListCollection = $spWeb.lists
        $spListCollection.add("$ShortListName","",$listTemplate)
        $list = $spweb.lists[$ShortListName]
        $list.Title = $ListName
	$list.update()

The powershell not accepting the "$list.Title" part.

If it should be ok, then maybe the problem caused by language. My sharepoint using hungarian language settings.

But even replace the Title for the hungarian "cím" (or any other form of the translation), it won't work.


I Hate Mondays


Viewing all articles
Browse latest Browse all 11571

Trending Articles