Copy-PnPFile PowerShell在线但具有不同的网站集

时间:2017-12-21 07:45:21

标签: powershell onedrive sharepoint-online

我正在编写一个powershell脚本,用于将文件(文档)从OneDrive站点复制到SharePoint站点。它们位于不同的网站集中。

我正在使用此命令:

Copy-PnPFile -SourceUrl $file.fieldvalues.FileRef -TargetUrl $destpath -OverwriteIfAlreadyExists -Force -ErrorVariable errors -ErrorAction SilentlyContinue

但它给了我404错误。我认为错误来自-sourceurl参数,因为它们来自不同的网站集。我尝试添加源文件的整个URL,但它给了我这个错误:

Copy-PnPFile : Value does not fall within the expected range.

我可以使用$docLibrary = $ctx.Web.Lists.GetByTitle("Documents")加载文件,但我不确定如何将其内容复制到SharePoint网站。有没有可行的办法?

P.S:我使用$items = Get-PnPListItem -List Documents -PageSize 1000.

从onedrive获取文件

0 个答案:

没有答案
相关问题