Share via

Document library migration Author field

Anonymous
2017-06-22T04:15:27+00:00

Hi, I have been migrating an old sharepoint company intranet that contains a large number of subsites and document libraries. Leveraging PowerShell PNP scripts this was progressing well until yesterday (21-JUN-17) when my script starting reporting an old error that I had thought I resolved.

Error: Exception calling "ExecuteQuery" with "0" argument(s): "Invalid data has been used to update the list item. The field you are trying to update may be read only."

This is occurring when updating the Author field. This is required to retain correct history.

I know there are many statements around that this field is indeed a read-only field. Though using 3rd party tools it is obvious that it indeed is possible as these update the Author field to the original author and not the account doing the migration. This includes keeping the version history intact with authors and dates as was my script.

I'm asking... 1) what has changed in last 24-36 hours? 2) a powershell script that works with current online version (JUN-2017) that modifies the Author and date fields.

Regards

Microsoft 365 and Office | SharePoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2017-06-26T11:51:22+00:00

Hi LateNightDBA,

You can refer to this thread: Keeping original modified date when migrating from on prem to online.

If you need more assistance, since this process requires customized PowerShell Scripts, please post this to MSDN Forum which is a specific support channel for these questions. Thanks for your understanding.

Disclaimer: Microsoft provides no assurances and/or warranties, implied or otherwise, and is not responsible for the information you receive from the third-party linked sites or any support related to technology.

Regards,

James

Was this answer helpful?

0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Anonymous
    2017-06-25T07:37:39+00:00

    So putting the PNP Sharepoint components aside, is there a straight powershell solution to this situation?

    Regards

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2017-06-24T07:36:31+00:00

    Hi LateNightDBA,

    As the issue happens with the SharePoint PnP PowerShell, we suggest you post the question to our MSDN SharePoint forum, which is dedicated to handling SharePoint development and programming related issues. Thanks for your understanding.

    Regards,

    Jiaxing

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2017-06-23T05:38:28+00:00
    1. Are you trying to migrate on-premise SharePoint libraries to SharePoint Online?

        - Yes. Note this question is about Document Libraries.

    1. 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."

    1. Does the issue happen to all document libraries or some specific one?

    Yes Now: This script has been running previously prior 21-JUN successfully

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2017-06-23T02:54:02+00:00

    Hi LateNightDBA,

    To better understand the situation, please confirm the information below:

    1. Are you trying to migrate on-premise SharePoint libraries to SharePoint Online?
    2. If so, please share with us your detailed steps to reproduce the issue, together with the PowerShell script you used.
    3. Does the issue happen to all document libraries or some specific one?

    Regards,

    Jiaxing

    Was this answer helpful?

    0 comments No comments