Hallo zusammen,
ich habe ein Powershell-Skript, mt dem ich eine Listenvorlage auf Basis einer 2010er-Aufgabenliste nach 2013 als stp-Datei in die Listenvorlagen hochlade (O.K.)
Anschließend soll auf Basis dieser Vorlage eine Liste erstellt werden. Hier habe ich allerdings das Problem, dass schinbar ein ungültiges Argument an die Funktion '$web.Lists.Add' übergeben wird.
Das Skript lautet wie folg:
--------------------------------------------------------------------
# Adding the PowerShell Snapin
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
# Get the SiteURL
$site = get-spsite("http://sp2013/")
# Get the root web
$web = $site.RootWeb
# Get the list template gallery
$spLTG = $web.getfolder("List Template Gallery")
# Get the list template gallery Collection
$spcollection = $spLTG.files
# Get the custom list template file
$Templatefile = get-item "C:\temp\v_test.stp"
# Add the custom list template file to gallery
$spcollection.Add("_catalogs/lt/v_test.stp", $Templatefile.OpenRead(), $true)
Write-Host "Custom Template Uploaded to List Template Gallery Successfully"
Write-Host “Creating the List based on the Template”
# Get the custom list templates
$CustomlistTemplates = $site.GetCustomListTemplates($web)
Write-Host $CustomlistTemplates["v_test"] #zeigt alle Informationen des Templates korrekt an!
---BIS HIER ALLE OK---
----AB HIER PROBLEM---
#Create the custom list using template
$web.Lists.Add("Projektsteuerung", "", $CustomlistTemplates["v_test"]) #$web.Lists.Add wirft argumentexception: Ungültiges Argument für 'template'
Write-Host "Based on the template List Created"
-----------------------------------------------------------------------------------------------------
Hat jemand eine Idee, was ich ändern muss?
Vielen Dank :-)