Today I tried to copy a file using Microsoft Flow. I started with a When a file is created or modified in a folder trigger.

Then I thought that get file metadata would be a good step. So that I can filter on the metadata so that I can decide if/when I get Flow to copy the file.

Then I added a send an email  action in. So that I can ensure that my Id is set to the id of the item.

Then I ran my flow by updating a document. This now triggers the flow but I got a bit of a surprise:

What is that Id? That is the Url to my document?

As the Get File properties action want the Id of the item this is quite annoying.

It looks like getting to the document properties could be quite tricky.

So far the only way around this problem is use the Get Files (properties only) and then use an apply to each to step through all your documents in your library. Then it is possible to compare the file name with the filename that triggered the Flow in the first place. This of course is not a very nice solutions as Flow will slow down when you get more documents in your library.

So why is this so complicated?

Well it is all in the trigger. Rather than using the When a file is created or modified I should have used the trigger When a file is created or modified (properties only)

This trigger returns all the properties of the document. Easy mistake to make, but not easy to fix.

 

 

 

 

Advertisements