- Are you trying to migrate on-premise SharePoint libraries to SharePoint Online?
- Yes. Note this question is about Document Libraries.
- If so, please share with us your detailed steps to reproduce the issue, together with the PowerShell script you used.
- I have Manually recreated the matching site structure in a fresh STS#0 site in O365
- Extracted this template site using SharePoint Pnp powershell library v2.16.1706.0
- Create new Destination Site STS#0
- Apply-PnPProvisioningTemplate
On Source sharepoint
LOOP: For each document in required library
for each version of the document
pnp-getfile – Save locally including version ID in file name
Populate
$Fileobject with relevant details Eg: Author Display name
Change Connection
On Destination O365 Site
Upload file
$FileStream
New-Object IO.FileStream($fileName,[System.IO.FileMode]::Open)
$FileCreationInfo
New-Object Microsoft.SharePoint.Client.FileCreationInformation
$FileCreationInfo.Overwrite
$true
$FileCreationInfo.ContentStream
$FileStream
$FileCreationInfo.URL
$UniqueFileName
$Upload
$Docs.RootFolder.Files.Add($FileCreationInfo)
$ctx.Load($Upload)
$ctx.ExecuteQuery()
return
$Upload
Once upload complete
Retrieve to Document library list item
$FileItem=Get-Pnpfile
-Url
$FileWebURL -AsListItem
-Web $NewWeb
$ctx=$fileItem.context
Get to required user (Author) details
$user=Get-PnpUser
|
? {$_.Title
-eq
$Fileobject.AuthorDisplayName}
Construct a user lookup string
$uTxt
"{0};#{1}" -f
$user.Id,
$user.LoginName
Update required details in fileitem
$FileItem["Editor"]
$uTxt
Update & commit.
$FileItem.UpdateOverwriteVersion()
$ctx.ExecuteQuery()
It appears that I may have overcome the original error as all testing now returns a different ERROR
☹
Exception calling "ExecuteQuery" with "0" argument(s): "The URL 'File name with spaces 5 Aug 2013.xlsx' is invalid.
It may refer to a nonexistent file or
folder, or refer to a valid file or folder that is not in the current Web."
- Does the issue happen to all document libraries or some specific one?
Yes Now: This script has been running previously prior 21-JUN successfully
