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

Is it possible to get all column names from a sharepoint list?

As topic, is there a way to show all column name from a sharepoint list? maybe a function that can generate a collection that contain all column name from a SP list?

12 REPLIES 12
WarrenBelz
Super User
Super User

Hi @fxavier ,

If you Collect the SharePoint List, all the columns will be in the collection 

ClearCollect(
   colYourColleciton,
   YourSPListName
)

You can display any fields you want in a gallery with the Items as the Collection.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

 

eka24
Super User
Super User

@fxavier 

Onvisible of the screen or on a button, create a collection;

ClearCollect (MyNames, SharePoint.ColumnName)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

fxavier
Frequent Visitor

@WarrenBelz @eka24 
There may be some misunderstandings. What I want to do is to extract all existing Column Name from a sharepoint list. LIke:

fxavier_0-1592810548104.png
Input: ShowAllColumnName(SharepointListName)
Output: ["ID","Model Picture", "Model Number", "Selector Switch", "Fuel Oil Level", "Lubrication Oil Level"]

Is it possible?

ClearCollect (MyNames, Sharepointlist); Clear (MyNames)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

fxavier
Frequent Visitor

but how do you get the column name from a collection?
I need to get the column name because I don't want to type them all out by my self. My sharepoint list have over 50 columns, I need to generate a collection include all the existing column name from a SP list.

Hi @fxavier ,

No, not possible as text. The column name itself is not an attribute you can "collect" in a statement other than referring to the actual name to get the contents of the field.

You can view the headings of a collection in View>Collections, but that is not something able to be done other than in Design mode (and that is only viewing).

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Your request may not be clear.

The formula i gave shows you all the column names in the Collection MyNames.

Have you tried the formula, if you have tried, have you checked the collection whether the table names are there or not from:

File....Collection

Or you meant getting the Name of the column into a textbox

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

fxavier
Frequent Visitor

what I want to do is get the column name as string and reuse it to build a form. Because I have over 50 columns want to put in to the form, I don't want to manually input it. What I am thinking is to store all the column name as string in a Collection, then use Last(FirstN()) to get those column name. Since there is no way to extract all column name from SP list as string, this seems like a dead end. 

What you are trying to do is not possible. You can't use a collection as a Datasource for a form. 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (1,811)