SOLVED
Home

Locking a file for approval

%3CLINGO-SUB%20id%3D%22lingo-sub-876434%22%20slang%3D%22en-US%22%3ELocking%20a%20file%20for%20approval%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-876434%22%20slang%3D%22en-US%22%3E%3CP%3EMy%20apologies%20for%20asking%20this%20here%2C%20I've%20been%20searching%20for%20a%20long%20time%20to%20resolve%20this%20and%20I'm%20sure%20I'm%20missing%20a%20trick%20somewhere.%26nbsp%3B%20What%20I%20want%20to%20do%20is%20to%20create%20a%20document%20approval%20flow%20whereby%20the%20document%20is%20locked%20during%20the%20approval%20process%20so%20it%20can't%20be%20altered%20ie.%20that%20all%20the%20people%20who%20are%20approving%20the%20document%20know%20that%20they%20are%20approving%20the%20same%20thing.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20can%20think%20of%20a%20few%20ways%20that%20this%20might%20possibly%20work%20e.g.%20locking%20the%20document%20so%20it%20can't%20be%20edited%20or%20referring%20the%20approval%20to%20a%20particular%20version%20of%20the%20document%20so%20you%20know%20if%20it%20has%20been%20altered%20or%20not.%26nbsp%3B%20I%20was%20even%20wondering%20about%20pushing%20the%20version%20along%20with%20approval%20history%20into%20a%20new%20column%20to%20make%20it%20easier%20to%20track.%20I'm%20struggling%20to%20find%20any%20way%20of%20achieving%20this%20using%20Flow%20but%20I%20suspect%20it%20is%20because%20I%20am%20doing%20this%20in%20the%20wrong%20way.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20reference%20the%20files%20I%20am%20trying%20to%20approve%20are%20in%20a%20document%20library%2C%20that%20document%20library%20has%20been%20set%20for%20Content%20Approval%20rather%20than%20Request%20Sign%20Off%20flows%20and%20I%20am%20trying%20to%20use%20an%20instant%20flow%20so%20that%20users%20will%20pick%20the%20appropriate%20approval%20flow%20when%20it%20needs%20to%20be%20done.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20realise%20that%20signing%20a%20document%20might%20be%20an%20alternative%20whereby%20I%20know%20that%20the%20document%20hasn't%20been%20changed%20since%20it%20was%20signed%20but%20then%20I%20get%20into%20the%20more%20difficult%20realm%20of%20managing%20certificates%20for%20people%20who%20have%20signed%20it.%26nbsp%3B%20Flows%20seem%20nice%2C%20elegant%20and%20easy%20for%20my%20users%20to%20manage%20if%20I%20can%20get%20change%20control%20under%2C%20well%2C%20control%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20any%20help%20or%20advice%20on%20this%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERichard%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-876434%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-878236%22%20slang%3D%22en-US%22%3ERe%3A%20Locking%20a%20file%20for%20approval%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-878236%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F415523%22%20target%3D%22_blank%22%3E%40RichPepp%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EMy%20initial%20thought%20was%20to%20add%20%22Check-out%22%20and%20%22Discard%20Check-out%22%20Actions%20to%20an%26nbsp%3B%3C%2FSPAN%3Eexisting%20approval%20Flow%20template%20but%20that%20didn't%20workout%20because%20the%20%22%3CSPAN%3EEid%22%20field%20(used%20when%20setting%20the%20Content%20Approval%26nbsp%3BStatus)%20changed%20from%20%22Check-Out%22%20and%20%22Discard%20Check-out%22%20actions.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EIf%20you%20turn%20off%20Content%20Approval%20and%20use%20a%20custom%20Flow%20you%20can%20achieve%20most%20of%20what%20you%20outline.%20When%20a%20file%20is%20added%20it%20triggers%20the%20Flow%20and%20%22Checks%20out%22%20the%20file.%20I%20added%20a%20site%20column%20called%20Status.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20860px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F133709i045BE94CDE7150C5%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture.PNG%22%20title%3D%22Capture.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EOnce%20approved%20the%20Status%20is%20set%20to%20%22Approved%22%20and%20the%20%22Check%20out%22%20is%20discarded.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20852px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F133710iC3D45C1AC1A7CBB6%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture1.PNG%22%20title%3D%22Capture1.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EIf%20rejected%2C%20the%20Status%20is%20set%20accordingly%20and%20the%26nbsp%3B%22Check%20out%22%20is%20discarded.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20844px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F133711i74F815235582BCFE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture2.PNG%22%20title%3D%22Capture2.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EHere%20is%20the%20Flow%20I%20used%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F133712i33A55565B8AEDE1A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture3.PNG%22%20title%3D%22Capture3.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt's%20important%20to%20note%20that%20the%20file%20version%20will%20increase%20with%20each%20action%20against%20the%20file%20(i.e.%20Status%20column%20changes).%20Not%20sure%20if%20that%20is%20a%20show%20stopper.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20hope%20this%20helps.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENorm%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-878416%22%20slang%3D%22en-US%22%3ERe%3A%20Locking%20a%20file%20for%20approval%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-878416%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F111382%22%20target%3D%22_blank%22%3E%40Norman%20Young%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20VERY%20much%20for%20trying%20that%20out.%26nbsp%3B%20I%20had%20wanted%20to%20try%20it%20that%20way%20but%20failed%20because%20when%20I%20added%20the%20CheckOut%20action%20I%20needed%203%20bits%20of%20info.%26nbsp%3B%20The%20site%20address%20and%20library%20name%20were%20easy%20but%20then%20I%20also%20needed%20the%20'Id%20of%20the%20list%20item%20the%20file%20is%20attached%20to'.%26nbsp%3B%20%26nbsp%3BMy%20document%20was%20in%20a%20document%20library%20rather%20than%20a%20list%20so%20there%20was%20no%20id%20to%20use%20that%20I%20could%20think%20of.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20don't%20really%20have%20a%20problem%20using%20a%20list%20if%20that%20is%20necessary%20but%20can%20you%20tell%20me%20how%20you%20structured%20things%20to%20manage%20this%3F%26nbsp%3B%20The%20CheckOut%20method%20does%20seem%20like%20a%20good%20idea%20to%20me%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnd%20thanks%20again%20for%20doing%20that%2C%20it%20was%20extremely%20helpful%20to%20see%20that%20that%20method%20would%20work%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERichard%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-878594%22%20slang%3D%22en-US%22%3ERe%3A%20Locking%20a%20file%20for%20approval%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-878594%22%20slang%3D%22en-US%22%3EEdit%3A%20I%20can%20use%20CheckOut%20if%20I%20can%20get%20find%20ItemID%20of%20the%20file%20but%20I%20haven't%20been%20able%20to%20get%20it%20from%20the%20manual%20trigger%20'For%20a%20selected%20File'.%20If%20I%20pull%20the%20ItemID%20using%20'Get%20file%20metadata%20using%20path'%20then%20I%20can%20use%20ItemID%20to%20CheckOut%20the%20file%20and%20all%20is%20well%2C%20but%20I%20haven't%20been%20able%20to%20get%20the%20ItemID%20of%20the%20file%20from%20the%20initial%20manual%20trigger.%20I'm%20sure%20this%20must%20be%20possible%2C%20I've%20just%20missed%20a%20trick%20somewhere%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%20for%20your%20help%3CBR%20%2F%3E%3CBR%20%2F%3ERichard%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-878714%22%20slang%3D%22en-US%22%3ERe%3A%20Locking%20a%20file%20for%20approval%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-878714%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F415523%22%20target%3D%22_blank%22%3E%40RichPepp%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUse%20a%20variable%20to%20store%20the%20%22FileId%22%20and%20then%20%22Get%20files%22%20to%20get%20the%20related%20metadata.%20An%20snippet%20from%20a%20like%20Flow%20listed%20below.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20624px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F133741iF9A2CFBE709FC22D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Capture.PNG%22%20title%3D%22Capture.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EI%20hope%20this%20helps.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENorm%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-878717%22%20slang%3D%22en-US%22%3ERe%3A%20Locking%20a%20file%20for%20approval%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-878717%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F111382%22%20target%3D%22_blank%22%3E%40Norman%20Young%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThat's%20quite%20a%20clever%20way%20of%20doing%20it%2C%20I'll%20give%20it%20a%20shot.%26nbsp%3B%20I%20had%20tried%20GetFiles%20but%20had%20got%20stuck%20on%20the%20filtering.%26nbsp%3B%20I'll%20see%20if%20your%20trick%20helps%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-878749%22%20slang%3D%22en-US%22%3ERe%3A%20Locking%20a%20file%20for%20approval%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-878749%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F111382%22%20target%3D%22_blank%22%3E%40Norman%20Young%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnd%20it%20works!%26nbsp%3B%20Thank%20you%20very%20much%20for%20that%20trick%2C%20I%20don't%20think%20I%20would%20ever%20have%20found%20it%20on%20my%20own%20as%20it%20was%20just%20one%20step%20removed%20from%20what%20I%20was%20expecting%20to%20have%20to%20do.%26nbsp%3B%20%26nbsp%3BI%20can%20now%20check%20the%20file%20out%20successfully%20so%20I%20should%20be%20able%20to%20work%20on%20the%20rest%20of%20the%20process%20now%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20again%20and%20best%20wishes%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERichard%3C%2FP%3E%3C%2FLINGO-BODY%3E
RichPepp
Occasional Contributor

My apologies for asking this here, I've been searching for a long time to resolve this and I'm sure I'm missing a trick somewhere.  What I want to do is to create a document approval flow whereby the document is locked during the approval process so it can't be altered ie. that all the people who are approving the document know that they are approving the same thing.

 

I can think of a few ways that this might possibly work e.g. locking the document so it can't be edited or referring the approval to a particular version of the document so you know if it has been altered or not.  I was even wondering about pushing the version along with approval history into a new column to make it easier to track. I'm struggling to find any way of achieving this using Flow but I suspect it is because I am doing this in the wrong way.

 

For reference the files I am trying to approve are in a document library, that document library has been set for Content Approval rather than Request Sign Off flows and I am trying to use an instant flow so that users will pick the appropriate approval flow when it needs to be done.  

 

I realise that signing a document might be an alternative whereby I know that the document hasn't been changed since it was signed but then I get into the more difficult realm of managing certificates for people who have signed it.  Flows seem nice, elegant and easy for my users to manage if I can get change control under, well, control

 

Thanks for any help or advice on this

 

Richard

6 Replies
Highlighted
Solution

Hi @RichPepp,

 

My initial thought was to add "Check-out" and "Discard Check-out" Actions to an existing approval Flow template but that didn't workout because the "Eid" field (used when setting the Content Approval Status) changed from "Check-Out" and "Discard Check-out" actions.

 

If you turn off Content Approval and use a custom Flow you can achieve most of what you outline. When a file is added it triggers the Flow and "Checks out" the file. I added a site column called Status.

Capture.PNG

Once approved the Status is set to "Approved" and the "Check out" is discarded.

Capture1.PNG

If rejected, the Status is set accordingly and the "Check out" is discarded.

Capture2.PNG

 

Here is the Flow I used:

Capture3.PNG

 

It's important to note that the file version will increase with each action against the file (i.e. Status column changes). Not sure if that is a show stopper.

 

I hope this helps.

 

Norm

 

 

Highlighted

Hi @Norman Young 

 

Thank you VERY much for trying that out.  I had wanted to try it that way but failed because when I added the CheckOut action I needed 3 bits of info.  The site address and library name were easy but then I also needed the 'Id of the list item the file is attached to'.   My document was in a document library rather than a list so there was no id to use that I could think of.  

 

I don't really have a problem using a list if that is necessary but can you tell me how you structured things to manage this?  The CheckOut method does seem like a good idea to me

 

And thanks again for doing that, it was extremely helpful to see that that method would work

 

Richard

Highlighted
Edit: I can use CheckOut if I can get find ItemID of the file but I haven't been able to get it from the manual trigger 'For a selected File'. If I pull the ItemID using 'Get file metadata using path' then I can use ItemID to CheckOut the file and all is well, but I haven't been able to get the ItemID of the file from the initial manual trigger. I'm sure this must be possible, I've just missed a trick somewhere

Thanks for your help

Richard
Highlighted

Hi @RichPepp,

 

Use a variable to store the "FileId" and then "Get files" to get the related metadata. An snippet from a like Flow listed below.

Capture.PNG

I hope this helps.

 

Norm

Highlighted

Hi @Norman Young 

 

That's quite a clever way of doing it, I'll give it a shot.  I had tried GetFiles but had got stuck on the filtering.  I'll see if your trick helps

Highlighted

@Norman Young 

And it works!  Thank you very much for that trick, I don't think I would ever have found it on my own as it was just one step removed from what I was expecting to have to do.   I can now check the file out successfully so I should be able to work on the rest of the process now

 

Thanks again and best wishes

 

Richard