web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Incrementing a SharePo...
Power Automate
Answered

Incrementing a SharePoint version number

(0) ShareShare
ReportReport
Posted on by 1,934 Moderator

I need to increment the version number of a document in a SharePoint library to the next whole number version after the document has gone through an approval process. I can't find any way to do this apart from checking out the file then immediately checking it back in, configuring it for a major version check-in. Is there any better way of doing this--more elegant, more reliable?

annetoal_0-1647956622184.png

 

annetoal_1-1647956715802.png

Thanks,

Anne

Categories:
I have the same question (0)
  • Yvonne Profile Picture
    12 on at

    Hi, 

    Did you every get an answer or a solution for this?

  • annetoal Profile Picture
    1,934 Moderator on at

    No, I ended up using the "Check file in" action, using the "Major version (publish)" option in the drop-down choices.

     

    Anne

  • Yvonne Profile Picture
    12 on at

    Thank you

  • Yvonne Profile Picture
    12 on at

    I will keep trying to find a solution

     

  • Verified answer
    SamLed Profile Picture
    2,338 Moderator on at

    Hi,

     

    No need to check out files before publishing, just call publish API method (there is also a unpublish() method if needed):

    SamLed_0-1692872731650.png

     

    Pay attention to highlighted path, Path dynamic content proposes web relative URL (/Document Library/..) while API need server relative URL (/sites/site name/Library name/..)

    ______________________________________________________________

    If I have answered your question, please Accept the post as solution.
    If you like my response, please Thumbs Up.

      

  • annetoal Profile Picture
    1,934 Moderator on at

    I just tested this and it works a treat!

     

    Making it easier for folks to paste the solution:

     

    _api/web/GetFileByServerRelativeUrl('/sites/daa/it/@{outputs('Get_file_properties')?['body/{FullPath}']}')/Publish()

     

    Where {FullPath} is

     

    outputs('Get_file_properties')?['body/{FullPath}']

     

    If this helped, please give it a thumbs up!

  • Yvonne Profile Picture
    12 on at

    Hi SamLed

    Thank you for your response.

    I am trying to decrease the version number by one version in the document history each time the flow is run.  Is that possible do you know?  The flow to decrease version number history of selected document

  • SamLed Profile Picture
    2,338 Moderator on at

    Hi,

    If you want to update item without increasing version number like SystemUpdate() does in C#, use validateUpdateListItem API method:

     

    SamLed_1-1692954596727.png

    Here, I've updated item title without increasing version number, bNewDocumentUpdate boolean does the trick.

    ______________________________________________________________

    If I have answered your question, please Accept the post as solution.
    If you like my response, please Thumbs Up.

     

     

  • Yvonne Profile Picture
    12 on at

    Thank you but what I really need to do is decrease the current version in the version history of the document.  

  • SamLed Profile Picture
    2,338 Moderator on at

    Hi,

     

    You can't remove a version or decrease version number. Why do you want to do so?

    ______________________________________________________________

    If I have answered your question, please Accept the post as solution.
    If you like my response, please Thumbs Up.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard