I'm building a Power App that can connect to SharePoint task lists to update task data. These task lists are created when the using the "Sync with SharePoint" button in its associated Microsoft Project file. The data sources used in Power Apps point directly to the task lists in SharePoint.
The problem: when a new task list is created, the app does not automatically create and connect to a new data source for this task list. The data source must manually be added through the user interface in the Power Apps editor.
Is there a way to automatically or dynamically load various data sources based on a user's selection within the app, or do all data sources need to be statically set in the Power Apps editor before runtime?
Solved! Go to Solution.
In general the connectors pick up the schema of the data source when you create the connection. This makes it impossible to work with a dynamic connection because the connector doesn't have access to the schema. I have gotten it to work, but it takes a lot of manual effort because everything needs to be coded as a JSON item record where you supply all the right fields. That's a requirement because the connection doesn't know what the data source schema looks like because it can't pick it up at runtime. So yes, its theoretically possible, but extremely difficult and prone to error in practice.
In general the connectors pick up the schema of the data source when you create the connection. This makes it impossible to work with a dynamic connection because the connector doesn't have access to the schema. I have gotten it to work, but it takes a lot of manual effort because everything needs to be coded as a JSON item record where you supply all the right fields. That's a requirement because the connection doesn't know what the data source schema looks like because it can't pick it up at runtime. So yes, its theoretically possible, but extremely difficult and prone to error in practice.
Can you please elaborate on the process?
Here's an example. I put the ListName in a variable and then used it as a custom entry in the Create Item action. Since the list is dynamic the action can't retrieve the schema so the only field I get is Item. To create an Item I need to define a JSON record with the four fields in the list and their values. It works, but it means you will always be responsible for creating an Item record with the right schema.
User | Count |
---|---|
162 | |
91 | |
68 | |
64 | |
63 |
User | Count |
---|---|
210 | |
157 | |
93 | |
81 | |
71 |