cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
3tsolutions
Advocate I
Advocate I

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

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

3 REPLIES 3
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

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

ravi_0111
New Member

@3tsolutions Hi, I am new to power apps, How do we run this flow or how to call this flow from Powerapps

AlexinEdmonton
Frequent Visitor

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 ',':

AlexinEdmonton_0-1649359881459.png

which when run gives us the internal column names in a list that's relatively easy to copy and paste into whatever formula:

AlexinEdmonton_1-1649359967478.png

 

Cheers,

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (2,892)