【发布时间】:2021-12-23 10:52:24
【问题描述】:
我正在尝试将文件夹/文件从一个共享点站点移动到另一个站点,但我似乎无法让 Receive-PnPCopyMoveJobStatus 在我的 powershell 脚本中工作
目前,我可以监控文件/文件夹移动的唯一方法是监控源的回收站是否有更改。我希望能够按需取得进展,或者在开放的 powershell 中始终如一地取得进展。理想情况下,我希望看到一个百分号,甚至是一个详细的选项。
这是我整理的:
#Config Variables
$SiteURL = "https://<site>.sharepoint.com/
$SourceFolderURL= "sites/<site name>/<document library name>/<Folder or file location>"
$TargetFolderURL = "sites/<site name>/<document library name>"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -interactive
#Sharepoint Copy/Move operation feedback
$Test = "Move-PnPFile -SourceUrl $SourceFolderURL -TargetUrl $TargetFolderURL -Overwrite -noWait"
$jobStatus = "Receive-PnPCopyMoveJobStatus -Job $Test"
if($jobStatus.JobState -eq 0)
{
Write-Host "Job finished"
}
我没有成功运行它。当我填写站点名称、库名称和实际站点时,我得到的结果看起来像是完成了,但没有反馈,文件也没有移动。所以基本上什么都没有发生。
文件/文件夹移动的作用如下:
#Config Variables
$SiteURL = "https://<site>.sharepoint.com/"
$SourceFolderURL= "sites/<site name>/<document library>/<folder name>"
$TargetFolderURL = "sites/<site name>/<document library>"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -interactive
#sharepoint online powershell move folder
Move-PnPFile -SourceUrl $SourceFolderURL -TargetUrl $TargetFolderURL -overwrite
#Read more: https://www.sharepointdiary.com/2017/06/how-to-move-folder-in-sharepoint-online.html#ixzz7Bkp822M1
任何有关更正此脚本的帮助,或查看 SharePoint 上复制或移动操作进度的其他方法,我们将不胜感激!
【问题讨论】:
标签: powershell sharepoint-online script