Document Migration: Is it possible to update Major Version document metadata fields, Author, Editor, Created and Modified

sharepoint.stackexchange https://sharepoint.stackexchange.com/questions/129728

  •  01-10-2020
  •  | 
  •  

Frage

I have a library where version is enabled, both for Major and Minor versions. And I am importing documents to this library that has a lot of metadata I need to set including the internal fields Author, Editor, Created and Modified. It is working fine for updating documents that are minor version, I use the SPListItem.UpdateOverwriteVersion() after settings the Author, Editor, created and Modified fields after i have checked-in the document with a minor version. And this works fine.

My problem is this approach does not work for Major version documents, then Modified by is set to the account I am currently using to import the documents. If I try to run the SPListItem.UpdateOverwriteVersion() command a new minor version is created after the major version.

Is there anyway to update Major version documents in a library to set the Author, Editor, Created and Modified fields without creating a new minor version?

Edit: Found the solution that works and it is below.

War es hilfreich?

Lösung

So I found the only working solution. As Version is enabled on the library, both for Minor and Major versions, after i have done the check-in of the major version (that I need to change the Author, Editor, Created and Modified Fields on) I disable Minor versions on the library. After this change, I update the fields using SPListItem.UpdateOverwriteVersion(). This results in the major version being updated with the correct values. After the values have been changed, I enable Minor Versions on the library again.

Of course don't have anyone working in the library while you do the migration as it could have unexpected consequences while Minor versions are turned off, if they are expected to exist.

Andere Tipps

For other fields you could simply use SystemUpdate but that doesn't work with "Modified", "Created", etc.

Option 1:

In the migration process upload all the document as minor version, set all the metadata and then publish the documents that have to be in major version.

Option 2:

If you can't repeat the migration as in Option 1 then unpublish the document, do your modifications then MajorCheckIn the document.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit sharepoint.stackexchange
scroll top