web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Variable for sharepoin...
Power Apps
Answered

Variable for sharepoint library in a gallery

(0) ShareShare
ReportReport
Posted on by 147

Hello,

 

I have installed a Sharepoint library based on the following article: https://www.matthewdevaney.com/power-apps-navigating-folders-subfolders-in-a-sharepoint-document-library/

 

So far everything is perfect, thank you very much for the article.

Now I have a problem with variables.

I would like to create a view that jumps to the corresponding subfolder using a variable and then also lists other content (from the folder).

Onstart:

Set(varFolderPathMarketingMITMark; "Marketing/Flyer/");;

 

Now I would like to switch from another gallery to the Sharepoint library using a button. Using the following code:

Set(

        varFolderPathVariable1;

        ThisItem.'Name'

    );;

 

 

I created a new screen for this function and inserted a new gallery with the following code:

Gallery Items:

SortByColumns(

    Filter(

        Items_1;

        Titel in varFolderPathVariable1

    );

    "{IsFolder}";

    SortOrder.Descending;

    "{Name}";

    SortOrder.Ascending

)

 

Unfortunately, the gallery doesn't show me any content

Categories:
  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @memphis11 ,

     

    Firstly, you'd have to concatenate the folder name with the main folder:

    Set(
     varFolderPathVariable1;
     Concatenate(varFolderPathMarketingMITMark; ThisItem.'Name')
    );;

     

    then in Items of Gallery:

    SortByColumns(
     Filter(
     Items_1;
     varFolderPathVariable1 in 'Folder path'
     );
     "{IsFolder}";
     SortOrder.Descending;
     "{Name}";
     SortOrder.Ascending
    )

     

    Best regards,

  • memphis11 Profile Picture
    147 on at

    Hello,

    Thank you very much, now I'm going one step further.
    However, I stay at the entry point in the gallery, so I see the main folder and not the selected folder.

     

    From the Gallery (this is from the Sharepoint list), per Button:

    Set(
    varFolderPathVariable1;
    Concatenate(varFolderPathCurrent; ThisItem.'Name')
    );;
    Navigate(Screen_Folder_Variable);;

    Gallery items:

    SortByColumns(
    Filter(
    Items_1
    varFolderPathVariable1 = 'Folder Path'
    );
    "{IsFolder}";
    SortOrder.Descending;
    "{Name}";
    SortOrder.Ascending
    )

    if I set varFolderPathVariable1 in 'Folder path' in the gallery I see all folders and files in the entire library

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @memphis11 ,

     

    What's the Items of the first Gallery? I was using Documents as the data source.

     

    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard