cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Wait for file to be uploaded to library

Hi

 

I have a Flow that generates a PDF of the list item via OneDrive, once it is converted it moves the files to a SharePoint Library, this file is then sent via email to the creator.

 

Sometimes it takes 5+ minutes for Flow/OneDrive to generate the PDF and if the file is not already in the library then the next action which sends the email fails. Is there a way to make the Flow to wait for the file to be uploaded and automatically trigger the email when the file gets uploaded?

 

Capture.JPG

1 ACCEPTED SOLUTION

Accepted Solutions

Hi again!

Here you are the screenshots

 

First flow

Flow_fist_flow.png

 

Flow#1 is triggered whenever you select an item from a Sharepoint list. It gets SP item ID, for simplicity purposes example takes the same docx file from OneDrive4Business no matter the item selected, then converts it to pdf and stores it in the same OneDrive4Business folder. PDF filename is built with current date+current time+SP item ID

 

Second flow:

Flow_secondFlow.png

Flow#2 is triggered whenevera new file is created in OneDrive4Business Folder. It verifies its extension, if not pdf stop execution. If pdf, extracts SP item ID. For simplicity purposes example get tem description from the SP list, but you can customize it to update the item.

 

My final screenshot show how to trigger Flow#1 from Sharepoint, and the Get Item response in Flow#2

Flow_manualTrigger_SPitem.png

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

11 REPLIES 11
Dual Super User III
Dual Super User III

I would try putting a DoUntil loop in front of the email.  Then do a Get File {properties only) action inside the loop and test to see if the result is null.  When the file is returned then exit the loop and proceed with the email.  I would also put a delay in the loop before the get file to only do it once a minute or once every 30 seconds.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Super User III
Super User III

@Anonymous 

All pdf files you create are stored in the same library / directory, right?

If so, did you try to split your flow in two?

I mean, the first flow keeps the current trigger: when an item is created flow#1 creates a file and converts it to pdf

The second flow will trigger on when a file is created: use as filters the target directory and the extension (.pdf). If any of these conditions do not apply, flow#2 will terminate its execution vie Terminate action block. If both of them apply, flow#2 will move the file to sharepoint etc.

You can also keep a single flow by adding the second trigger inside, just between "Convert file" and "Move file to sharepoint" action blocks, but this option is a bit more complex in my opinion and would probably require a paralel branch in case PDF conversion is too fast.

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Community Support
Community Support

Hi @Anonymous ,

 

Perhaps you could  consider adding two Delay action after Create file action and Get file content action, with an interval of 3-5 minutes.

29.PNG

Please take a try.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable


@efialttes wrote:

@Anonymous 

All pdf files you create are stored in the same library / directory, right?

If so, did you try to split your flow in two?

I mean, the first flow keeps the current trigger: when an item is created flow#1 creates a file and converts it to pdf

The second flow will trigger on when a file is created: use as filters the target directory and the extension (.pdf). If any of these conditions do not apply, flow#2 will terminate its execution vie Terminate action block. If both of them apply, flow#2 will move the file to sharepoint etc.

You can also keep a single flow by adding the second trigger inside, just between "Convert file" and "Move file to sharepoint" action blocks, but this option is a bit more complex in my opinion and would probably require a paralel branch in case PDF conversion is too fast.

Hope this helps


Thank you. This is a good idea but how can I get the ID from the First flow? I need to ensure the details reach the same person who raised the request. 

Anonymous
Not applicable


@v-bacao-msft wrote:

Hi @Anonymous ,

 

Perhaps you could  consider adding two Delay action after Create file action and Get file content action, with an interval of 3-5 minutes.

29.PNG

Please take a try.

 

Best Regards,


Thanks. I do not want every request to wait for 6 minutes. In most instances the PDF is created within a minute but there are some where it takes 5+ minutes. 

Anonymous
Not applicable


@Pstork1 wrote:

I would try putting a DoUntil loop in front of the email.  Then do a Get File {properties only) action inside the loop and test to see if the result is null.  When the file is returned then exit the loop and proceed with the email.  I would also put a delay in the loop before the get file to only do it once a minute or once every 30 seconds.


Thanks. I tried to implement it but I cant make it work. I am trying to make the loop check if the item exists every 30 seconds. 

Capture.JPG

Hi!
I see your point... You can add the ID as part of the filename, or store in a new sp list an item matching filename, ID and whatever other info you require in the second flow
I am currently in a local Flow event, if you need it I can work on an example in some hours
Hope this helps


Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Anonymous
Not applicable

I tried my best to figure out how to do it. I have the ID number in the file names but it is not possible to figure out what the ID would be from the first flow. I could do it by last uploaded date and person but there may be instances when multiple requests could be uploaded at the same time by same or different users. 

 

It would be of great help if you could provide an example on how to achieve using 2 flows. 

@Anonymous

I am working on an example flow. I need to confirm the following: Are you using OneDrive or OneDrive for Business?



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Anonymous
Not applicable

I am using OneDrive for Business.

Hi again!

Here you are the screenshots

 

First flow

Flow_fist_flow.png

 

Flow#1 is triggered whenever you select an item from a Sharepoint list. It gets SP item ID, for simplicity purposes example takes the same docx file from OneDrive4Business no matter the item selected, then converts it to pdf and stores it in the same OneDrive4Business folder. PDF filename is built with current date+current time+SP item ID

 

Second flow:

Flow_secondFlow.png

Flow#2 is triggered whenevera new file is created in OneDrive4Business Folder. It verifies its extension, if not pdf stop execution. If pdf, extracts SP item ID. For simplicity purposes example get tem description from the SP list, but you can customize it to update the item.

 

My final screenshot show how to trigger Flow#1 from Sharepoint, and the Get Item response in Flow#2

Flow_manualTrigger_SPitem.png

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (40,206)