我在“$ spWeb.List”
行获取“无法索引到空数组”我正在使用Windows7家庭高级版和Sharepoint Foundation 2010
我尝试将用户添加到shell Add-SPShellAdmin -username -database ..失败的通知 错误是帐户名称已使用与帐户
不同的用户名作为登录名添加到数据库中请建议!。
"============================================================================="
$PSSnapin = Remove-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | Out-Null
$PSSnapin = Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | Out-Null
$spWeb = Get-SPWeb http://krishna-hp:11944/sites/sh100/
$spList = $spWeb.List["products"]
$newItem = $splist.Items.Add()
$newItem["Title"] = "this is title"
$newItem["product_id"] = 34
$newItem["product_desc"] = "this is from poershell"
$newItem["price"] = 123
$newItem.Update()
答案 0 :(得分:1)
简单只需更改行
$ spList = $ spWeb.List [“products”]
到
$ spList = $ spWeb.Lists [“products”]工作了!