I've been looking for a way to have the column names of a SharePoint list so that I don't have to type them manually; I didn't find ready-made solutions, so I decided to create a custom solution for the purpose.
I created a flow with power automate, which can be trigger from PowerApps, in which it is requested:
Step 1 ) Build an instant cloud flow and Choose how to trigger this flow with PowerApps
Step 2) Use Compose to ask in PowerApps 3 inputs:
Step 3) Get items from SharePoint list and use the first two Compose Inputs , limit the count to 1 and choose to use all columns list
Then Create a CSV Table , using the list of elements
outputs('Get_items')?['body/value']
Step 4) Define the variables that we will have to use in the flow
decodeUriComponent('%0A')
first(split(body('Create_CSV_table'),outputs('Compose_NewLine')))
Step 5) Let's check that the third input defines to enable column filters
If NO just set the variable columns_name with the headers
if YES we need to exclude all column names reserved by SharePoint
Step 6) For each headers
split(variables('headers'),',')
exclude the reserved name, than set the variable columns_name with a columns_name_filtered
substring(variables('columns_name_filtered'),0,sub(length(variables('columns_name_filtered')),1))
we use a substring to eliminate the comma at the end of the filtered string
Step 6bis) to exclude the names of the reserved columns we use a control in OR condition,
than append the filtered columns to the variable columns_name_filtered with a comma
concat(item(),',')
Step 7) finally we send the response to PowerApps
Solved! Go to Solution.
Hi @3tsolutions ,
Thank you for sharing the solution which is great helpful for the community.
So could you consider leave a reply then accept it as the solution to help other members find it?
Best regards,
Community Support Team _ Jeffer Ni
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Hi @3tsolutions ,
Thank you for sharing the solution which is great helpful for the community.
So could you consider leave a reply then accept it as the solution to help other members find it?
Best regards,
Community Support Team _ Jeffer Ni
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
@3tsolutions Hi, I am new to power apps, How do we run this flow or how to call this flow from Powerapps
Thank you so much for posting this solution! I thought I'd throw in my adaptation of your solution which gives me the column names in the Flow a bit quick for a simple copy and paste: After the step that gets the "column names filtered" which gives the string with all items, I just added a new array variable that splits on the ',':
which when run gives us the internal column names in a list that's relatively easy to copy and paste into whatever formula:
Cheers,
Thanks for sharing this!
I reviewed your method and was going to try it this way, but then I went down the rabbit hole of wondering if it was exposed via an endpoint, and sure enough, it is! Instead of using a CSV, I'll just use a SharePoint HTTP action, append array action to create the table of columns! If you like my 3-step flow, please mark it as a second solution!
1. HTTP request to SharePoint:
a. Site Address: team site URL, not root site URL
b. GET
c. URI: /_api/web/lists/getbytitle('LISTNAME')/fields?$filter=Hidden eq false and ReadOnlyField eq false
- Also, the filter above takes care of all of the reserved columns except for "Content Type" and "Attachments", which could be removed by changing the URI to: /_api/web/lists/getbytitle('LISTNAME')/fields?$filter=Hidden eq false and ReadOnlyField eq false and Title ne 'Content Type' and Title ne 'Attachments'
2. Run the flow/perform this request to get a sample payload
3. Add Parse JSON step, using the body from the previous step and paste in the sample payload in the "Generate from sample" option
4. Append "Title" to an array variable inside of an Apply to Each loop based on "results"