jeudi 12 mars 2015

Add columns to existing libraries in SharePoint 2010 using Powershell

I need to add five new columns to existing SharePoint 2010 libraries using powershell.

I am using below script:

$ver = $host | select version
if($Ver.version.major -gt 1) {$Host.Runspace.ThreadOptions = "ReuseThread"}
if(!(Get-PSSnapin Microsoft.SharePoint.PowerShell -ea 0))
Write-Progress -Activity "Loading Modules" -Status "Loading Microsoft.SharePoint.PowerShell"
Add-PSSnapin Microsoft.SharePoint.PowerShell

$SourceWebURL = "http://sitecollection/sites/site"
$SourceLibraryTitle = "libraryName"

$ssite = Get-SPSite $SourceWebURL
$sweb = $ssite.OpenWeb("subsite")

#$sWeb = Get-SPWeb $SourceWebURL
$sList = $sWeb.Lists | ? {$_.Title -eq $SourceLibraryTitle}

$spFieldType = [Microsoft.SharePoint.SPFieldType]::Text

Column is getting created but it is not showing in the library

0 commentaires:

Enregistrer un commentaire