Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

How to reliably filter Sharepoint documents for an entity in a canvas app?

(0) ShareShare
ReportReport
Posted on by 241

I have enabled sharepoint for a certain entity in my environment and added files to it. Now I want to display a list of files for a selected entity in my Canvas app.

 

My current (test) code looks something like this. I have added a CDS connector to the entity, as well as a CDS connector to Document Locations and SharePoint Sites, and a Sharepoint connector pointing to the entity base folder.

 

Now, after selecting an entity from a dropdown, I use the following code to determine the folder for the item:

 

UpdateContext({ documentlocation: First( Filter('Document Locations', Regarding=Dropdown1.Selected )) });
UpdateContext({ folder_base: "vdt_projectdefinitie/"&documentlocation.'Relative URL'&"/" });
UpdateContext({ folder_prefix: folder_base }); /* ideally used to navigate to subfolders later */

 

Then I added a Gallery with the Items property set to:

 

SortByColumns(Filter(Projectdefinitie, Mappad=folder_prefix), "{IsFolder}",Descending,"{FilenameWithExtension}",Ascending)

 

( "Mappad" is the localized "Folder Path" property )


After running a test, I saw that this will populate the gallery correctly filtered on the chosen entity:

sp.png

But I still get a delegation warning so it wouldn't work on large data sets. The delegation warning not only applies to the filter on the folder path, but also on the sorting on the columns.

 

According to this post I dug up, the root cause seems to be the fact that said columns are calculated. But I'm not sure how to proceed from here. Any advice?

  • MrNappa Profile Picture
    241 on at
    Re: How to reliably filter Sharepoint documents for an entity in a canvas app?

    Thanks. I've browsed through the posts in the ideas forum marked with relevant sharepoint tags, but couldn't find any, so I created one here.

  • v-xida-msft Profile Picture
    on at
    Re: How to reliably filter Sharepoint documents for an entity in a canvas app?

    Hi @MrNappa ,

    Thanks for your feedback. I afraid that there is no direct way to achieve your needs in PowerApps currently.

     

    If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

    https://powerusers.microsoft.com/t5/Power-Apps-Ideas/idb-p/PowerAppsIdeas

     

    Best regards, 

  • MrNappa Profile Picture
    241 on at
    Re: How to reliably filter Sharepoint documents for an entity in a canvas app?

    Hi Kris, thanks for the reply.

     

    > Could you please share a screenshot about the Delegation warning issue with your Filter formula?

    dw2.png

    > Is the "Projectdefinitie" a SP library on your side?
    It's the name of the SP data source. (It's the name of the entity for which Sharepoint was enabled in Dynamics -- after specifying a sharepoint URL, I chose this as 'list' from the options). I think it points to just the root folder for that entity in sharepoint.
    ds.png

    Actually, it is an known issue with the 'Folder Path' column in a SP Library. Currently, the 'Folder Path' field of a SP Library could not be delegated within a Filter function in PowerApps app currently.
    Yeah, that's what I gathered (as stated in OP)... Do you know if this on the radar as something to be fixed/improved? Maybe a thread in the ideas/suggestions forum I can vote on? It really sounds as something that should work 'out of the box'...

    >As an alternative solution, I think the collection could achieve your needs. [snip]
    However, this would only remove the warning that the editor gives me. The underlying problem would remain. I don't know if (and if so, when) the customer would reach the maximum number of files, but once they do the app would show unexpected behavior.

  • v-xida-msft Profile Picture
    on at
    Re: How to reliably filter Sharepoint documents for an entity in a canvas app?

    Hi @MrNappa ,

    Could you please share a screenshot about the Delegation warning issue with your Filter formula?

    Is the "Projectdefinitie" a SP library on your side?

     

    Actually, it is an known issue with the 'Folder Path' column in a SP Library. Currently, the 'Folder Path' field of a SP Library could not be delegated within a Filter function in PowerApps app currently.

     

    As an alternative solution, I think the collection could achieve your needs. You could consider save your SP Library records into a collection in your app, then use the collection as data source in your app rather than original SP Library data source.

     

    I have made a test on my side, please consider take a try with the following workaround:

    Set the OnStart property of App to following:

    ClearCollect(LocalSPLibrary, Projectdefinitie)

     

    Set the Items property of your Gallery to following:

    SortByColumns(
     Filter(Projectdefinitie, 'Folder path' = folder_prefix), 
     "{IsFolder}", Descending,
     "{FilenameWithExtension}", Ascending
    )

    or

    SortByColumns(
     Filter(Projectdefinitie, Mappad = folder_prefix), 
     "{IsFolder}", Descending,
     "{FilenameWithExtension}", Ascending
    )

    then re-load your app (fire the OnStart property of App), check if the issue is solved.

    Note: Please make sure you have set the "Data row limit for Non-delegable queries" option to maximum value -- 2000 within Advanced settings of App settings of your app.

     

    Best regards,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,658 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard