SHOW COLUMNS

SHOW COLUMNS displays information about the columns in a given list. The SHOW FIELDS command is a synonym for SHOW COLUMNS.

This command always return same columns. For the complete listing see the SHOW COLUMNS reference.

Syntax

SHOW {COLUMNS | FIELDS}
FROM list_name [.{view_name | content_type_name | ALL | ATTACHMENTS}];

Example: to show columns of list Employees:

SHOW COLUMNS FROM Employees

Code example: Get all columns in the default view of a list and print name and SharePoint type. For the complete listing of possible types see the SHOW COLUMNS reference.

Print list columns

using (var connection = new SharePointConnection(connectionString))
{
    connection.Open();
    using (var command = new SharePointCommand("SHOW COLUMNS FROM Tasks", connection))
    {
        using (var reader = command.ExecuteReader())
        {
            while (reader.Read())
            {
                Console.WriteLine(reader["Name"].ToString().PadRight(40) + " : " + reader["Type"].ToString());
            }
        }
    }
}

Code result

Attachments                              : Attachments
DocIcon                                  : Computed
LinkTitle                                : Computed
AssignedTo                               : User
Status                                   : Choice
Priority                                 : Choice
DueDate                                  : DateTime
PercentComplete                          : Number
Predecessors                             : LookupMulti


Skip Navigation Links.

Visa     MasterCard