【问题标题】:Unable to Get SP List Due with Additional Parameter in Url由于 URL 中的附加参数,无法获取 SP 列表
【发布时间】:2020-03-26 17:24:58
【问题描述】:

我可以使用以下Document Library 检索文档库的List 名称:

http://test.com/RecordsDocument/

但是,我遇到以下List 的错误:

http://test.com/Lists/FilePlan

不同之处在于第二个 URL 中的附加 /Lists/ 组件。

下面是我的代码 sn-p,请问我该如何解决这个问题?

$baseUrl="http://test.com/"
$web = Get-SPWeb $baseUrl

$RDlistName ="RecordsDocument"    //success
$FPlistName ="Lists/FilePlan"     //failed
//$FPlistName ="FilePlan"         //failed

$RDlist = $web.Lists[$RDlistName] //success
$FPlist = $web.Lists[$FPlistName] //null value

Write-host List Name: $RDlist     //success
Write-host List Name: $FPlist     //null value

【问题讨论】:

    标签: list powershell sharepoint


    【解决方案1】:

    只需在 $web.Lists 中使用列表名称:

    $FPlistName ="FilePlan"
    $FPlist = $web.Lists[$FPlistName]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-20
      • 2012-12-19
      • 2019-08-11
      • 2014-06-13
      • 1970-01-01
      • 2019-08-24
      • 2015-05-14
      • 1970-01-01
      相关资源
      最近更新 更多