I use a SharePoint list to display a graphics in javascript and I want to get dynamically the name of the columns of my list and not write them in my code. Is there any way to that. To get my list, I use

var list = clientContext.get_web().get_lists().getByTitle(listTitle);
var camlQuery = new SP.CamlQuery();
camlItems = list.getItems(camlQuery);

I try to find a function to get the name/Title of the column but I don't find it.

  • Do you want to get internal name of list or name of list columns? – Viraj Gorajia Nov 30 '16 at 11:19
  • I want the name of list colum to use it as axis on my grap^h – Marilyn Nov 30 '16 at 13:49

add to your code


clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), 
                                Function.createDelegate(this, function(sender, args){}));        

function onQuerySucceeded(sender, args) {

   var listItemInfo = '';
   var listItemEnumerator = camlItems.getEnumerator();
   var oListItem = listItemEnumerator.get_current();

get_fieldValues() return list af all columsName (internalName)

  • thank you for your answer, but the function return all data in the liste name of column and fielsd value. I try to find a function which return only the name of the column of my lits – Marilyn Nov 30 '16 at 13:51

You can query the REST Service like this:


Example (excludes Hidden and ReadOnlyField fields):

var url = "/_api/web/lists/GetByTitle(' " + listTitle + " ')/fields?$select=Name,Title&$filter=Hidden eq false and ReadOnlyField eq false";
function getFieldPropertis(url) {
        url: _spPageContextInfo.webAbsoluteUrl + url,
        type: "GET",
        headers: {
            "accept": "application/json;odata=verbose",
        success: function (data) {
        error: function (error) {

for displays the title and internal name of all fields, see https://msdn.microsoft.com/en-us/library/hh185009.aspx?f=255&mspperror=-2147217396#Anchor_4

  • Thank you, i try the methods but il retrieve informations for all fields of the list not only the list column. Do you know a method or property i cna use to select only the column of my list. – Marilyn Dec 1 '16 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.