错误:通过Power Shell访问Sharepoint列表

错误:通过Power Shell访问Sharepoint列表,sharepoint,powershell,Sharepoint,Powershell,我在“$spWeb.List”行得到“无法索引到空数组” 使用WiMWS7 Home Point和SharePoint基金会2010 我试图将用户添加到shell add SPShellAdmin-username-database。。不通知 错误是该帐户名已使用与该帐户不同的用户名作为登录名添加到数据库中 请建议 "=============================================================================" $PSSnapin

我在“$spWeb.List”行得到“无法索引到空数组”

使用WiMWS7 Home Point和SharePoint基金会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()

换线很简单

$spList=$spWeb.List[“产品”]


$spList=$spWeb.Lists[“产品”]有效

只需更改线路即可

$spList=$spWeb.List[“产品”]

$spList=$spWeb.Lists[“产品”]有效