Powershell PnP 共享点

Powershell PnP Sharepoint

如何上传文件并在上传文件的同时更新元数据? 我想上传一个文件并且(在 SharePoint 上我有一个像 deleteFromLocal flag = no 的列,所以当我上传文件时它应该在文件上传后更改为是)。有什么办法吗?

代码到现在:

Import-Module SharePointPnPPowerShellOnline 

#Get Connection to the url , #Connect-PnPOnline $URL 

Connect-PnPOnline "Some SharePoint Url" -UseWebLogin

$Files = Get-ChildItem "Local Folder Path which contains the files"

foreach($File in $Files){
    
    $upload = Add-PnPFile -Folder "some folder inside Shared Documents in sharepoint" -Path $File.FullName
    if($upload.UniqueId){
        $successCounter += 1
        $message = "Successfully Uploaded" 
    } else {
        $failCount +=1
        $message = "ERROR - Unable to Upload"
    }
    }

编辑:文件上传成功,但我想通过此脚本本身修改 column/add 列,而不是手动添加(列 - 元数据,如标志,会告诉我 Yes/no - 无论文件是否成功上传,以便将来需要时我可以获取该标志并执行必要的操作)。

假设 Yes/No 字段是“deleteFromLocal”,然后附加 -value 参数来设置此字段,如下所示:

$upload = Add-PnPFile -Folder "some folder inside Shared Documents in sharepoint" -Path $File.FullName  -Values @{deleteFromLocal=$true}