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"]
}

我尝试从归档的“项目”中提取值,但有人说“你不能在空值表达式上调用方法 >>>$splist.GetItems”

有人可以帮我找出原因并解决吗?

4

1 回答 1

0

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

$splist = $spWeb.Lists["OsEM1"]
于 2012-06-20T18:09:42.987 回答