Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过powershell将照片库添加到Sharepoint 2013_Sharepoint_Powershell 3.0 - Fatal编程技术网

通过powershell将照片库添加到Sharepoint 2013

通过powershell将照片库添加到Sharepoint 2013,sharepoint,powershell-3.0,Sharepoint,Powershell 3.0,我需要在sharepoint 2013中添加一个新的照片库。我有大部分脚本,但需要一些模板类型的帮助 这是剧本 enter code here [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipeline=add-sp$true)] [string]$Web, [Parameter(Mandatory=$true)] [string]$ListTitle, [Parameter(Mandatory=$true)] [s

我需要在sharepoint 2013中添加一个新的照片库。我有大部分脚本,但需要一些模板类型的帮助

这是剧本

enter code here
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true,ValueFromPipeline=add-sp$true)]
[string]$Web,
[Parameter(Mandatory=$true)]
[string]$ListTitle,
[Parameter(Mandatory=$true)]
[string]$ListUrl,
[Parameter(Mandatory=$false)]
[string]$Description,
[Parameter(Mandatory=$true)]
[string]$Template
)
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
Start-SPAssignment -Global
$SPWeb = Get-SPWeb -Identity $Web
**$listTemplate = $SPWeb.ListTemplates[$Template]**
$SPWeb.Lists.Add($ListUrl,$Description,$listTemplate)
$list = $SPWeb.Lists[$ListUrl]
$list.Title = $ListTitle
$list.Update()
$SPWeb.Dispose()
停止空间分配-全局

上面的$listTemplate=$SPWeb.ListTemplates[$Template]行是粗体的,因为这就是问题所在。当我运行在字符串库中传递的脚本时,问题是$listTemplate变量为null,并且在下一行失败

$Template参数是否有不同的值?我还可能做错什么

谢谢


Jim

应该传入的模板类型是图片库。所有其他代码保持不变