传递一组托管元数据项时,set-pnplistitem中发生错误

时间:2018-09-28 15:17:05

标签: powershell sharepoint-online

使用pnp powershell修改共享点联机列表项,我尝试更新现有列表项,添加一组托管元数据术语,但是当我尝试使用多个术语更新条目时,该命令始终失败。或者,如果我只传递一个带有单个项的数组变量。

set-pnplistitem -list "Pages" -Identity $itemID -values @{"Category"=("How-To")} -SystemUpdate #WORKS
set-pnplistitem -list "Pages" -Identity $itemID -values @{"Category"=("For Teams That Create Digital Content")} -SystemUpdate #WORKS
set-pnplistitem -list "Pages" -Identity $itemID -values @{"Category"=("How-To","For Teams That Create Digital Content")} -systemUpdate #FAILS
$test=@("How-To")
set-pnplistitem -list "Pages" -Identity $itemID -values @{"Category"=$test} -SystemUpdate # FAILS
$test=@("How-To","For Teams That Create Digital Content")
set-pnplistitem -list "Pages" -Identity $itemID -values @{"Category"=$test} -SystemUpdate # FAILS

error:
set-pnplistitem : Object reference not set to an instance of an object.
At C:\Powershell\test.ps1:120 char:13
+             set-pnplistitem -list "Pages" -Identity $itemID -va ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : WriteError: (:) [Set-PnPListItem], NullReferenceException
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Lists.SetListItem

我做错了吗,还是set-pnpListItem中存在错误?

0 个答案:

没有答案