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 / Is it possible to stor...
Power Apps
Unanswered

Is it possible to store a SharePoint list name as a variable?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I would like to be able to dynamically change the SharePoint list being used as the data source for a gallery by looking up a unique ID in a SharePoint list that stores IDs and the corresponding list name. There could be hundreds of unique ID-list pairings used, so hard-coding is not an option. Is this possible? I am willing to take any kind of solution (variable, lookup, collection, etc.).

Categories:
  • mdevaney Profile Picture
    29,993 Moderator on at

    @Anonymous 

    Hello again!  I will try my best to give you some ideas of what are possible here.

     

    Attempting to use a gallery for more than one datasource is problematic because the Items property of a gallery can only have one possible SharePoint list as datasource.  Using IF a statements to determine which gallery should be shown will not solve this problem.  The next idea is to create a new Collection, use it as the gallery's datasource and fill/clear it with the information from different SharePoint lists. This could work but there are two major limitations: both SharePoint lists must have exactly the same columns feeding into the collection and the maximum number of records is 500.  Not to mention it will increase the complexity of building your app.

     

    I think the simplest idea here is to try using multiple galleries: one gallery for each SharePoint list.  Place all of the galleries in the same position and use the Visible property to show or hide them.  Only one gallery should be showing at a time.  You could accomplish this by creating a variable called showGallery and setting it to a unique name for each gallery.

     

    Set(showGallery,"MyList1")

     

    To ensure the gallery for MyList1 is showing when you need it put this code into the Visible property of the gallery.

    showGallery="MyList1"

     

    Repeat this idea for each Gallery/SharePoint list and then build some method to toggle between them.

     

    Hopefully my idea is clearly explained and makes sense.  Please let me know what you think.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    Currently, PowerApps doesn't support dynamic data source. You can submit an idea or vote for this existing idea: Dynamic Data Source .

    What we can do in PowerApps is to hardcode the data source in condition statement, and display the fields with the same name and type of all data sources in gallery.

    Snipaste_2019-12-03_14-57-41.png

    However, Office365Master came up with a whole new idea, get the content stored in SharePoint online by Power Automate and Graph v2 API, checking his Blog and YouTube might open up some new ideas for you.

     

    Best regards,
    Sik

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 350 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 318

#3
Mohsin Ali Profile Picture

Mohsin Ali 220

Last 30 days Overall leaderboard