0
我在我的Powershell脚本中使用客户端对象模型(CSOM)进行文件上传。每次我运行它时都会在元数据设置完成后创建新版本。使用Powershell将文件上传到SharePoint
我怎样才能解决这个问题,所以只有一个版本会被创造出来的?
代码:
#Upload to SharePoint
$FileCreationInfo = New-Object Microsoft.SharePoint.Client.FileCreationInformation
$FileCreationInfo.Overwrite = $true
$FileCreationInfo.ContentStream = $FileStream
$FileCreationInfo.URL = $list.RootFolder.ServerRelativeUrl + "/" + $FolderName + "/" + $SourceFileName
$FileUploaded = $List.RootFolder.Files.Add($FileCreationInfo)
#Set Metadata
$properties = $FileUploaded.ListItemAllFields;
$Context.Load($properties)
$properties["DocLanguage"]="EN"
$properties.Update()
$context.ExecuteQuery()
在此先感谢。