. "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”
有人可以帮助我找到原因并解决这个问题吗?
答案 0 :(得分:0)
$splist
为空,因为当您设置$splist = $spWeb.Lists["/Lists/OsEM1"]
时,找不到列表“/ Lists / OsEM1”。我不相信你需要“/ Lists /”部分。再试一次:
$splist = $spWeb.Lists["OsEM1"]