2012-05-25 36 views
1

即時得到「無法索引到一個空陣」,在本着「$ spWeb.List」錯誤:通過電源外殼SharePoint列表訪問

進出口使用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() 

回答

1

其簡單的只是改變了線

$ spList = $ spWeb.List [ 「產品」]

$ spList = $ spWeb.Lists [ 「產品」]解決!