cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
3tsolutions
Frequent Visitor

How get columns name from sharepoint list

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:

  • the SharePoint site,
  • the name of the list
  • if you want all the columns or if you want to filter the reserved SharePoint columns

 

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:

  • the SharePoint site,
  • the name of the list
  • if you want all the columns or if you want to filter the reserved SharePoint columns (filter_enable)

1.jpg

 

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']

 

 

 

2.jpg

 

Step 4) Define the variables that we will have to use in the flow

  1. The identification of CR

 

 

decodeUriComponent('%0A')​

 

 

  • The headers of the CSV Table

 

 

first(split(body('Create_CSV_table'),outputs('Compose_NewLine')))​

 

 

  • The string columns_name_filtered
  • The string columns_name

3.jpg

 

 

 

 

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

4.jpg

 

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

5.jpg

 

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(),',')

6.jpg

 

Step 7) finally we send the response to PowerApps

7.jpg

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-jefferni
Community Support
Community Support

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

View solution in original post

1 REPLY 1
v-jefferni
Community Support
Community Support

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

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,205)