cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
drishm
Helper I
Helper I

Get Files within a Folder on SharePoint

Hi,

 

I have a flow that works well and this is what it does:

 

- Looks at the files within a folder on SharePoint and will send a monthly email reminder on the day it was upload i.e. if uploaded on 2nd January, on 2nd February/March/April, etc., you will get an email reminder about that specific file in that folder.

 

The issue arose that within that folder, there are sub-folders with files and the flow is not picking up the files within the sub-folders. 
I have tried adding a filter array but I am not too sure how and the flow is still failing. 

 

If anyone can assist, that would be greatly appreciated.

 

Thanks. 

 

1.JPG

6 REPLIES 6
Expiscornovus
Super User
Super User

Hi @drishm,

 

Just to double check. What is the value of your Include Nested Items option in your Get files (properties only) action. Is that field set to Yes in your configuration?

 

includenesteditems.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Hi @Expiscornovus , yes it is set to include nested items

drishm_0-1643809904159.png

 

Hi @Expiscornovus ,

 

Not sure if this might help...I went to one of the failed flows and noticed that it is failing under the "get file content" (I have this added in to attach the document in the email to the end user) so it fails on the folder but works on the file. So it will send the file but overall shows the flow as failing.


drishm_0-1643810187300.png

 

Failed below (1 of 3):

 

drishm_1-1643810240759.png

 

But successful in the same one (3 of 3):

 

drishm_2-1643810314354.png

 

Expiscornovus
Super User
Super User

Hi @drishm,

 

Like you mentioned, trying to use a Get File Content on a folder will generate an error. You can add a condition before the Get File Content to avoid this. Check if the IsFolder boolean field value is equal to false.

 

Below is an example of that approach

 

getfilecontent_isfolder.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Hi @Expiscornovus ,

 

So that step works 🙂 but it seems to be failing now on another previous step that worked. This is where it looks at the date the file was uploaded to send the email reminder on the next month on the same date though. It did not fail before.

"Unable to process template language expressions in action 'Compose_the_short_string' inputs at line '0' and column '0': 'The template language function 'substring' parameter is out of range: 'start index' must be non-negative integer and should be less than the length of the string. Please see https://aka.ms/logicexpressions#substring for usage details.'."

 

drishm_0-1643882724075.png

drishm_1-1643882767676.png

 

 

VictorIvanidze
Community Champion
Community Champion

You have to check also the DayOfMonth variable length.

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (1,188)