Sam Skinner
Sam Skinner

Reputation: 3

Filtering and Sorting a SharePoint Document Library in Dataflows/Power Query

I am trying to access an excel document in in a SharePoint document library using Dataflows/Power Query. I am using variables via a Dataverse table in my code and I'm able to get the URL to return. And I can get all of the files of the library to return by querying all of the objects in a super-folder, then filtering for the URL of the document library.

The problem is each of the various spreadsheets in this document library fall into one of two categories and in the document library there exists a choice column where each spreadsheet is labeled with which of the categories into which they fall. But when I query the super-folder, that specific column to the document library doesn't return. So I can't add a step to the query to filter by that column.

So how can I query a document library, including all of the columns that I've added, so that I can filter and sort to identify the specific document I'm looking for?

Here's what I have so far. Note that I've replaced the variable names and URL with generic values.

    let
      PSource = Json.Document(Web.Contents("https://WebLocationOfAPI")),
      PNav = PSource[value],
      PCust = Table.FromRecords(PNav),
      #"PCust 1" = PCust{[org_name = "SharePoint Variable"]}[org_url], 
      Source = SharePoint.Files(#"PCust 1", [ApiVersion = 15])
    in
      Source

This returns all documents that exist in the aforementioned super-folder without the needed column that I want to filter by.

I would also point out that I do not fully understand what exactly the lines above are doing; I am trying to adapt already existing code for my own purposes.

Upvotes: 0

Views: 37

Answers (0)

Related Questions