尝试从Powershell中的Sharepoint Online List检索查找值时出错

时间:2018-03-13 14:16:04

标签: powershell sharepoint

在以下代码中,我收到错误

  

无法转换" Microsoft.SharePoint.Client.FieldLookupValue"类型的值" Microsoft.SharePoint.Client.FieldLookupValue"键入" Microsoft.SharePoint.Client.FieldLookupValue"。

我正在按照我在此处找到的代码来获取查找值。

$myContext = Get-PnPContext
$ELWeb = $myContext.Web
$siteReqListName = "ClassCreation"
$queryStr = 
    "<View>
        <Query>
            <Where>
                <Eq>
                    <FieldRef Name='Subsite_x0020_Created'/>
                    <Value Type='Integer'>0</Value>
                </Eq>
            </Where>
        </Query>

    </View>"
$sites = @()
$sites = Get-PnPListItem -List $siteReqListName -Query $queryStr -Web $ELWeb

Disconnect-PnPOnline
foreach ($site in $sites) {
    $itemId = $site["ID"]
    $siteTitle = $site["Title"]
    $lookup = [Microsoft.SharePoint.Client.FieldLookupValue]$site["Class_x0020_Category"]
        $lookupValue=$lookup.LookupValue

}

0 个答案:

没有答案