Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
FM-Rad10
Frequent Visitor

Show files and subfolders from SharePoint.Contents source.

How do I show all files within all the subfolders of the Automation folder? Ultimately I want to be able to show the parent folder name and modified date of each file. 

 

let

     Source = SharePoint.Contents("https://365.sharepoint.com/sites/C", [ApiVersion = 15]),

     T = Source{[Name="T"]}[Content],

     Control = T{[Name="Control"]}[Content],

     Automation = Control{[Name="Automation"]}[Content]

in

     #"Automation"

1 ACCEPTED SOLUTION
FM-Rad10
Frequent Visitor

The way I've been able to get around this is this:

 

I had initally Expanded the Content field and then was unable to take it any further at the Expand Column option was removed. 

FMRad10_0-1698395262252.png   

FMRad10_1-1698395303611.png

 

It turns out that there were 2 "Binary" files at this level (Excel docs) that were stopping any further expansion. 

After filtering them out I was able to Expand the Content.Content field and get to the level I needed and see all the file attributes for the docs I wanted. 

 

While this solution gets me what I need it's nowhere near perfect and defintely a bit hack'ey in its application. If I had needed to include those filtered docs then I still wouldn't have a solution as to how to get to the level below while still retaining the files from the level above. 

 

 

 

My Query now looks like this:

 

let
     Source = SharePoint.Contents("https://365.sharepoint.com/sites/C", [ApiVersion = 15]),
     T = Source{[Name="T"]}[Content],
     Control = T{[Name="Control"]}[Content],
     Automation = Control{[Name="Automation"]}[Content],
     #"Expanded Content" = Table.ExpandTableColumn(Automation, "Content", {"Content", "Name", "Extension", "Date modified"}, {"Content.Content", "Content.Name", "Content.Extension", "Content.Date modified"}),
     #"Filtered Rows" = Table.SelectRows(#"Expanded Content", each ([Content.Extension] = "")),
     #"Expanded Content.Content" = Table.ExpandTableColumn(#"Filtered Rows", "Content.Content", {"Content", "Name", "Extension", "Date modified", "Folder Path"}, {"Content.Content.Content", "Content.Content.Name", "Content.Content.Extension", "Content.Content.Date modified", "Content.Content.Folder Path"})
in
    #"Expanded Content.Content"
 
 

 

View solution in original post

6 REPLIES 6
FM-Rad10
Frequent Visitor

The way I've been able to get around this is this:

 

I had initally Expanded the Content field and then was unable to take it any further at the Expand Column option was removed. 

FMRad10_0-1698395262252.png   

FMRad10_1-1698395303611.png

 

It turns out that there were 2 "Binary" files at this level (Excel docs) that were stopping any further expansion. 

After filtering them out I was able to Expand the Content.Content field and get to the level I needed and see all the file attributes for the docs I wanted. 

 

While this solution gets me what I need it's nowhere near perfect and defintely a bit hack'ey in its application. If I had needed to include those filtered docs then I still wouldn't have a solution as to how to get to the level below while still retaining the files from the level above. 

 

 

 

My Query now looks like this:

 

let
     Source = SharePoint.Contents("https://365.sharepoint.com/sites/C", [ApiVersion = 15]),
     T = Source{[Name="T"]}[Content],
     Control = T{[Name="Control"]}[Content],
     Automation = Control{[Name="Automation"]}[Content],
     #"Expanded Content" = Table.ExpandTableColumn(Automation, "Content", {"Content", "Name", "Extension", "Date modified"}, {"Content.Content", "Content.Name", "Content.Extension", "Content.Date modified"}),
     #"Filtered Rows" = Table.SelectRows(#"Expanded Content", each ([Content.Extension] = "")),
     #"Expanded Content.Content" = Table.ExpandTableColumn(#"Filtered Rows", "Content.Content", {"Content", "Name", "Extension", "Date modified", "Folder Path"}, {"Content.Content.Content", "Content.Content.Name", "Content.Content.Extension", "Content.Content.Date modified", "Content.Content.Folder Path"})
in
    #"Expanded Content.Content"
 
 

 

BA_Pete
Super User
Super User

Hi @FM-Rad10 ,

 

I think you can just remove the [Content] part from the end of the Automation step.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Sadly it just shows the attributes from the Automation folder and nothing else. 

 

Ah, ok. Try changing SharePoint.Contents to SharePoint.Files.

You should then be able to filter [Folder Path] on Text.Contains([Folder Path], "/Automation/".

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




well, after thinking that was the solution and even though it does work it's unusable as it's taken a report that refreshes in 3 mins to refreshing in 33 minutes. 

 

I'm now wondering if there's a way to extract the path from the step I'm on and using that within Folder.Files or something similar to show the required data. I've not come across a way yet. 

I had hoped to avoid Sharepoint.Files as it's so cumbersome but I think you're right. I can't seem to find a way of being able to apply a recursive search or jump from SP.Contents to SP.Files when I'm at the Automation folder. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.