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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

SharePoint Online Folder Parameters

Hi,

My company is moving to SP onine, and I'm in the process of migrating a lot of my source data and chaging data source paths for my reports... I have a document library on my site that contains a dozen + different folders within the one library.

I previously had a separate query for each of those folders; however, now when I try to connect to the SP online site, it only reads the library - not the folders themselves. When I try to combine and transform, It pulls all of the documents within the library... there is no option to limit by folder name. I'm trying to combine excel files within a given folder, but the list is too long to see most of the documents. I'm sure there's a way to do this with parameters, I just don't know how yet.

 

I did try to connect to one Table and the helper Query/sample file for the combine is pointing to the full folder path, but I can't (or don't know how) to change that in the parameter of the main query!

 

Query1

Source

= SharePoint.Files("https://ABC123COMPANY.sharepoint.com/sites/Metrics", [ApiVersion = 15])

 

invoke custom function (combine files)

 

Sample File Parameter

= Source{[Name="Drilldown 010419.xlsx",#"Folder Path"="https://ABC123COMPANY.sharepoint.com/sites/Metrics/AllReport/Drilldown/"]

 

The helper query is totally fine, but back on the main query, it breaksdown on the expanded table columns step because the key doesn't match - because it's pulling everything, instead of files from the one folder I want.

 

Please help!

 

Thank you,

Kim

 

Untitled picture 1.png

Untitled picture.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

When I connect to my Sharepoint online, I receive a field called Folder Path. I am able to filter on this path. Are you not getting the same field?

 

FolderPath.PNG

View solution in original post

5 REPLIES 5
Jimmy801
Community Champion
Community Champion

hello @Anonymous ,

 

on the normal sharepoint it was possible to navigate to the folder as described in following example. However I don't have access to a online sharepoint and therefore can't test it there. Give it a try and let us know

let
    Source = SharePoint.Tables("YourSharepoint", [ApiVersion = 15]),
    GotoLibrary = Source {[Id="IDofYourLibrary"]}[Items],
    RenamedColumns = Table.RenameColumns(GotoLibrary,{{"ID", "ID.1"}}),
    FilterForURL = Table.AddColumn
    (
        RenamedColumns,
        "ContainsFilterCriteria",
        each if Text.Contains(_[Folder][ServerRelativeUrl], "YourSearchCriteriaForFolder") = true then true else false
    ),
    FilteredRows1 = Table.SelectRows
    (
        FilterForURL, 
        each ([ContainsFilterCriteria] = true)
    ),
    RemovedOtherColumns = Table.SelectColumns
    (
        FilteredRows1,
        {"Folder"}
        ),
    ExpandedFolder = Table.ExpandRecordColumn
    (
        RemovedOtherColumns, 
        "Folder", 
        {"ItemCount", "Name", "ServerRelativeUrl", "WelcomePage", "Files", "ListItemAllFields", "ParentFolder", "Properties", "Folders"}, {"ItemCount", "Name", "ServerRelativeUrl", "WelcomePage", "Files", "ListItemAllFields", "ParentFolder", "Properties", "Folders"}
    ),
    ExpandedFiles = Table.ExpandTableColumn
    (
        ExpandedFolder, 
        "Files", 
        {"CheckInComment", "CheckOutType", "ContentTag", "CustomizedPageStatus", "ETag", "Exists", "Length", "Level", "MajorVersion", "MinorVersion", "Name", "ServerRelativeUrl", "TimeCreated", "TimeLastModified", "Title", "UIVersion", "UIVersionLabel", "Author", "CheckedOutByUser", "ListItemAllFields", "LockedByUser", "ModifiedBy", "Versions"}, {"CheckInComment", "CheckOutType", "ContentTag", "CustomizedPageStatus", "ETag", "Exists", "Length", "Level", "MajorVersion", "MinorVersion", "Name.1", "ServerRelativeUrl.1", "TimeCreated", "TimeLastModified", "Title", "UIVersion", "UIVersionLabel", "Author", "CheckedOutByUser", "ListItemAllFields.1", "LockedByUser", "ModifiedBy", "Versions"}
    )
in
    ExpandedFiles

 

If this post helps or solves your problem, please mark it as solution.
Kudos are nice to - thanks
Have fun

Jimmy

Anonymous
Not applicable

When I connect to my Sharepoint online, I receive a field called Folder Path. I am able to filter on this path. Are you not getting the same field?

 

FolderPath.PNG

Anonymous
Not applicable

Yes, I am. Thanks.
dax
Community Support
Community Support

Hi Kimberly_MT, 

I think you need to make sure each Excel in sharepoint folder are the same(column name and type), if they are not same, the next steps will prompt error(can't find column or key don't match). You could check this in your sample.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

This was not the issue - my problem is that I have one doc library with several folders - each folder contains multiple files - the files all share the same schema. I was just trying to set a parameter to narrow down by folder.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors