【发布时间】:2016-04-29 09:06:06
【问题描述】:
我正在尝试使用 PowerShell 将一批文件上传到 SharePoint Online,并且还包括元数据(列字段)。我知道如何上传文件,这很好用:
$fs = New-Object IO.FileStream($File.FullName,[System.IO.FileMode]::Open)
$fci= New-Object Microsoft.SharePoint.Client.FileCreationInformation
$fci.Overwrite = $true
$fci.ContentStream = $fs
$fci.URL = $file
$upload = $list.RootFolder.Files.Add($fci)
$ctx.Load($upload)
$ctx.ExecuteQuery()
而且我知道如何编辑字段/列,这很有效:
...
$item["project"] = "Test Project"
$item.Update()
...
$list.Update()
$ctx.ExecuteQuery()
但我不知道如何将两者联系在一起。我需要获取对我上传的文件的项目引用,以便我可以更新项目/文件的元数据。您可以猜到,PowerShell 和 SharePoint 对我来说都是全新的!
【问题讨论】:
标签: powershell sharepoint