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

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (23,060)