阅读sharepoint提交(我是菜鸟)

时间:2012-06-20 17:58:19

标签: sharepoint powershell powershell-v2.0

. "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\\sharepoint.ps1"
$spWeb = Get-SPWeb -Identity "http://nycs00058260/sites/usitp"
$splist = $spWeb.Lists["/Lists/OsEM1"]
$splist.GetItems("Item") | ForEach-Object{
 Write-Host $_["Item"]
}

我尝试从字段“Item”中确定值,但是说“你不能在空值表达式上调用方法>>> $ splist.GetItems”

有人可以帮助我找到原因并解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

$splist为空,因为当您设置$splist = $spWeb.Lists["/Lists/OsEM1"]时,找不到列表“/ Lists / OsEM1”。我不相信你需要“/ Lists /”部分。再试一次:

$splist = $spWeb.Lists["OsEM1"]