我有一些文件需要与SharePoint文档库保持同步。问题是某些文件超出了我目前拥有的250mb限制,但仅适用于该250mb限制以下的文件。我无法弄清楚如何使用相同的代码和较大的块将所需的相同递归文件上载到SharePoint?似乎我需要集成的是此页面的选项3-> LARGE FILE HANDLING - OPTION 3 (StartUpload, ContinueUpload and FinishUpload),并且似乎if (Test-Path($topSPOFolder+"\"+$aFileName.FullName))
并没有检查目标目录(如果存在要跳过并继续前进的文件)。任何帮助总是感激不尽。
$password = ConvertTo-SecureString "test123" -AsPlainText -Force
$username = "abc@def.com"
$cred = New-Object System.Management.Automation.PSCredential ($username, $password)
$makeUrl ="https://helloworld.sharepoint.com/sites/helloworld"
$sourcePath = "\\1.2.3.4\e$\MSI\packages\*\*.msi";
$topSPOFolder = "Shared Documents\packages\test";
# install pnp powershell..?
#Install-Module SharePointPnPPowerShellOnline
# connect to spo online
Connect-PnPOnline -Url $makeUrl -Credentials $cred
$fileNames = Get-ChildItem -Path $sourcePath -Recurse ;
foreach($aFileName in $fileNames)
{
if($aFileName.GetType().Name -ne "DirectoryInfo")
{
if (Test-Path($topSPOFolder+"\"+$aFileName.FullName))
{
Write-Host 'Skipping file, already downloaded' -ForegroundColor Yellow
return
} else {
$fn=$topSPOFolder;
Add-PnPFile -Path $aFileName.FullName -Folder $fn;
$fn=$null
}
}
}