none
How can we change the version number of a document?

    Question

  • Hi,

    Is there a way to change the version number of a document.

    For example:

    I got a document 1 with version 5.1.

    Now I create document 2 with some version, say 5.2, and then delete the document 1 .

    Can I overwrite document 2's version and make it 5.1?

    Is there some API which I can use to achieve this?


    pandey.shakti@hotmail.com

    Friday, April 22, 2016 6:59 AM

Answers

  • No, you can't.*

    *You could download the document, delete it entirely, re-upload the document and then loop through the version numbers but that is a bit clunky. I don't know of a safe way to change version numbers in SharePoint.

    The trick is normally to avoid adding versions if you don't want them.

    Friday, April 22, 2016 7:48 AM

All replies

  • No, you can't.*

    *You could download the document, delete it entirely, re-upload the document and then loop through the version numbers but that is a bit clunky. I don't know of a safe way to change version numbers in SharePoint.

    The trick is normally to avoid adding versions if you don't want them.

    Friday, April 22, 2016 7:48 AM
  • Thx Alex for your answer.

    Here's my problem.

    I am developing a backup application which back up Sharepoint Online and Sharepoint On premise.

    We want to backup list documents with all its properties, and while restoring, we want the document back with all its properties(Date modified, date created , author and version history).

    When I backup the documents, I create a copy and record all attributes and metadata.

    When I restore it back, I do it in two steps:

    1. Restore the document.

    2. Apply the attributes and set the properties. (Created date, last modified, author etc).

    When I do step 1, I get the original version, but when I do step 2, I get a new version number.

    There are two different APIs which do these two steps.

    So I can have two solutions.

    How can I alter the document (change its properties) in Step1 without changing its version number.

    or

    How can I delete item in step 1. and assign its version number to document in Step 2.

    I have this version challenge only with SP Online, for On Premise, I've no problem. We have API to do it.

    Any help is much appreciated.

    Thx,

    Shakti


    pandey.shakti@hotmail.com

    Tuesday, April 26, 2016 5:39 AM
  • You need to merge your approach for the restoration process, or moderate your expectations. That means using the same API and reducing the number of update events.
    Tuesday, April 26, 2016 8:20 AM
  • Alex,

    I can't cut down the number of update events, I need to restore the document as it was backed up without missing key properties.


    pandey.shakti@hotmail.com

    Tuesday, April 26, 2016 9:19 AM
  • The only other way to avoid incrementing the version is to use the SystemUpdate() method. I don't know of a way to do that with any of the CSOM/REST etc. APIs.
    Tuesday, April 26, 2016 9:30 AM