powershell - 传递托管元数据术语数组时,set-pnplistitem 出错
问题描述
使用 pnp powershell 修改 sharepoint 在线列表项,我正在尝试更新现有列表项,添加一组托管元数据术语,但是当我尝试使用多个术语更新条目时,该命令一直失败。或者,如果我传递一个带有单个术语的数组变量。
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 有错误?
解决方案
推荐阅读
- amazon-s3 - Amazon S3 可以充当 Kafka 集群的源吗?
- vba - Catia 屏幕捕获代码
- powershell - 用于 pptx 文件的 Windows 上的 Grep
- php - 我的 PHP 提交按钮不起作用。如何解决?
- python - 查找每个 clientId 的新旧映射之间的差异
- java - 重定向到具有 @RequestBody 参数的 API
- javascript - 将 gulp-qunit 控制台输出输出到文件
- azure - 无法调试 Azure 函数 - Visual Studio 2017
- jquery - 添加自定义类以在 html 中打开和关闭时选择选项
- android - 单击回收站视图中的项目时查看全屏图像