【发布时间】:2014-05-12 04:16:57
【问题描述】:
我们使用在线共享点作为 Office 365 的一部分(我的脚本不是从共享点服务器本身运行的)。我想在完成处理后重命名\移动共享点中的文件。我找到了一种将文件下载到我的电脑的方法,但我似乎找不到重命名文件或将其移动到站点中的其他目录的方法。
环境:Sharepoint 在线 Powershell:Powershell 3.0
我正在使用以下代码来获取项目列表
`$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$ctx.Credentials = $credentials
$list = $ctx.Web.Lists.GetByTitle('Documents')
$camlQuery = New-Object Microsoft.SharePoint.Client.CamlQuery
$camlQuery.ViewXml = '<View Scope="RecursiveAll">
<Query>
<Where>
<And>
<Contains>
<FieldRef Name="FileDirRef" />
<Value Type="Text">' + $path+ '</Value>
</Contains>
<Eq>
<FieldRef Name="File_x0020_Type" />
<Value Type="Text">XLS</Value>
</Eq>
</And>
</Where>
</Query>
</View>'
Write-Host $camlQuery.ViewXml
#$camlQuery.FolderServerRelativeUrl="/Doron";
$items = $list.GetItems($camlQuery)
$ctx.Load($items)
$ctx.ExecuteQuery()`
但找不到重命名文件或将其移动到其他目录的方法。
你能建议吗?
谢谢 多伦
【问题讨论】:
标签: powershell sharepoint file-rename