Getting the Version number of a SharePoint document with Flow

%3CLINGO-SUB%20id%3D%22lingo-sub-26283%22%20slang%3D%22en-US%22%3EGetting%20the%20Version%20number%20of%20a%20SharePoint%20document%20with%20Flow%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-26283%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Everyone%2C%20recently%20I%20tried%20to%20setup%20a%20flow%20that%20reacts%20on%20a%20file%20change%20and%20reads%20the%20version%20of%20a%20document.%20I%20would%20like%20to%20check%20if%20this%20is%20a%20major%20version%20copy%20it%20to%20another%20library.%20Now%20I%20have%20seen%20the%20Action%20%22Get%20File%20Metadata%22%20-%20but%20this%20does%20not%20give%20me%20the%20version%20of%20the%20file.%20Is%20there%20any%20way%20to%20get%20the%20version%20of%20the%20file%20that%20got%20changed%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-26283%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Flow%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-333130%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20the%20Version%20number%20of%20a%20SharePoint%20document%20with%20Flow%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-333130%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20the%20feedback.%20When%20I%20was%20originally%20looking%20into%20this%20those%20endpoints%20didn't%20exist.%20For%20what%20I%20am%20using%20it%20for%20it%20is%20more%20useful%20to%20get%20both%20components%20of%20the%20version%20number%20but%20I%20will%20have%20to%20update%20the%20article%20to%20include%20some%20notes%20about%20those%20endpoints.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGlenn%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-333120%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20the%20Version%20number%20of%20a%20SharePoint%20document%20with%20Flow%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-333120%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYour%20%3CA%20href%3D%22https%3A%2F%2Fwww.glennprince.com%2Fblog%2Fcreating-a-version-monitoring-flow-in-sharepoint%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eblog%20post%3C%2FA%3E%20is%20really%20awesome%20and%20interesting.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20would%20suggest%20to%20refer%20below%20endpoint%20of%20SharePoint%20where%20you%20could%20reduce%20the%20number%20of%20steps.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CSPAN%3E%3CSTRONG%3EGET%3A%20Minor%20Version%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%2Fweb%2Fgetfilebyserverrelativeurl(%3CSPAN%3E'%2FShared%20Documents%2Ffilename.docx'%3C%2FSPAN%3E)%2F%3CSPAN%3EMinorVersion%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSTRONG%3EGET%3A%20Major%20Version%3C%2FSTRONG%3E%3CBR%20%2F%3E%2Fweb%2Fgetfilebyserverrelativeurl('%2FShared%20Documents%2Ffilename.docx')%2FMajorVersion%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FPRE%3E%0A%3CP%3EIf%20you%20still%20need%20both%20Major%20and%20Minor%20version%20numbers%2C%20I%20may%20go%20with%20your%20way%20since%20multiple%20HTTP%20requests%20will%20reduce%20the%20performance%20of%20workflow.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ENeed%20to%20read%20more%3F%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EFind%20below%20reference%20from%20Microsoft%20MSDN%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Foffice%2Fdn450841.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Foffice%2Fdn450841.aspx%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EKushan%20Perera%20%7C%20Microsoft%20MVP%3C%2FP%3E%0A%3CP%3EWeb%3A%20%3CA%20href%3D%22http%3A%2F%2Fwww.kushanperera.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ekushanperera.com%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EBlog%3A%20%3CA%20href%3D%22http%3A%2F%2Fblog.kushanperera.com%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eblog.kushanperera.com%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-282061%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20the%20Version%20number%20of%20a%20SharePoint%20document%20with%20Flow%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-282061%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20this%20Glenn%20-%20exactly%20what%20I%20needed%20i.e.%20to%20be%20able%20to%20pass%20up%20the%20version%20number%20to%20an%20approver%20when%20submitting%20a%20controlled%20document%2C%20so%20that%20the%20document%20and%20version%20is%20all%20part%20of%20an%20auditable%20process.%26nbsp%3B%20Cheers.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-263150%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20the%20Version%20number%20of%20a%20SharePoint%20document%20with%20Flow%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-263150%22%20slang%3D%22en-US%22%3E%3CP%3EHeya%2C%20I%20know%20this%20is%20a%20bit%20of%20an%20old%20post%20but%26nbsp%3BI%20had%20a%20similar%20experience%20while%20I%20was%20trying%20to%20mock%20up%20a%20prototype%20for%20integration%20between%20SharePoint%20and%20a%20record%20keeping%20system.%20To%20get%20around%20it%20you%20can%20send%20a%20HTTP%20request%20to%20the%20SharePoint%20API%20with%20the%20file%20identifier%20to%20retrieve%20the%20list%20of%20versions%2C%20get%20the%20latest%20version%20and%20make%20a%20decision%20on%20that.%20If%20your%20still%20interested%20you%20can%20find%20a%20full%20walk%20through%20on%20my%20blog%20here%3A%26nbsp%3B%3CA%20title%3D%22Creating%20a%20Version%20Monitoring%20Flow%20in%20SharePoint%22%20href%3D%22https%3A%2F%2Fwww.glennprince.com%2Fblog%2Fcreating-a-version-monitoring-flow-in-sharepoint%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3ECreating%20a%20Version%20Monitoring%20Flow%20in%20SharePoint%3C%2FA%3E%3C%2FP%3E%3CP%3ECheers%2C%20Glenn.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-30160%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20the%20Version%20number%20of%20a%20SharePoint%20document%20with%20Flow%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-30160%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Oliver%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAt%20the%20moment%20you%20can't%20get%20the%20version%20number%20of%20a%20document%20using%20Flow.%20Flow%20only%20returns%20a%20select%20number%20of%20properties%20for%20a%20document.%20That%20means%20you%20also%20can't%20use%20custom%20metadata.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20not%20sure%20when%20Microsoft%20is%20going%20to%20add%20this%20fuctionality%20to%20Flow.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1374220%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20the%20Version%20number%20of%20a%20SharePoint%20document%20with%20Flow%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1374220%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F194809%22%20target%3D%22_blank%22%3E%40Glenn%20Prince%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGod%20bless%20you%2C%20sir.%20This%20is%20a%20wonderful%20Flow%2C%20and%20you%20are%20very%20clear%20in%20your%20explanation%20of%20how%20to%20set%20it%20up.%20Well%20done%2C%20and%20much%20appreciated!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Frequent Visitor

Hi Everyone, recently I tried to setup a flow that reacts on a file change and reads the version of a document. I would like to check if this is a major version copy it to another library. Now I have seen the Action "Get File Metadata" - but this does not give me the version of the file. Is there any way to get the version of the file that got changed?

6 Replies
Highlighted

Hi Oliver,

 

At the moment you can't get the version number of a document using Flow. Flow only returns a select number of properties for a document. That means you also can't use custom metadata. 

 

I'm not sure when Microsoft is going to add this fuctionality to Flow. 

Highlighted

Heya, I know this is a bit of an old post but I had a similar experience while I was trying to mock up a prototype for integration between SharePoint and a record keeping system. To get around it you can send a HTTP request to the SharePoint API with the file identifier to retrieve the list of versions, get the latest version and make a decision on that. If your still interested you can find a full walk through on my blog here: Creating a Version Monitoring Flow in SharePoint

Cheers, Glenn.

Highlighted

Thanks for this Glenn - exactly what I needed i.e. to be able to pass up the version number to an approver when submitting a controlled document, so that the document and version is all part of an auditable process.  Cheers.

Highlighted

Hello,

 

Your blog post is really awesome and interesting.

 

I would suggest to refer below endpoint of SharePoint where you could reduce the number of steps. 

 

GET: Minor Version
/web/getfilebyserverrelativeurl('/Shared Documents/filename.docx')/MinorVersion

GET: Major Version
/web/getfilebyserverrelativeurl('/Shared Documents/filename.docx')/MajorVersion

If you still need both Major and Minor version numbers, I may go with your way since multiple HTTP requests will reduce the performance of workflow. 

 

Need to read more?

Find below reference from Microsoft MSDN

https://msdn.microsoft.com/en-us/library/office/dn450841.aspx

 

Kushan Perera | Microsoft MVP

Web: kushanperera.com

Blog: blog.kushanperera.com

Highlighted

Hi,

 

Thanks for the feedback. When I was originally looking into this those endpoints didn't exist. For what I am using it for it is more useful to get both components of the version number but I will have to update the article to include some notes about those endpoints.

 

Glenn

Highlighted

@Glenn Prince 

 

God bless you, sir. This is a wonderful Flow, and you are very clear in your explanation of how to set it up. Well done, and much appreciated!