SHOW VIEWS

SHOW VIEWS displays information about all views of a given list.

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

Syntax

SHOW VIEWS FROM list_name;

Example: to show views of list Employees:

SHOW VIEWS FROM Employees

Code example: Get all views of a list and print display name and a boolean that tells which view is default.

Print list views

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

Code result

All Tasks                                : True
My Tasks                                 : False
Due Today                                : False
Active Tasks                             : False
By Assigned To                           : False
By My Groups                             : False


Skip Navigation Links.

Visa     MasterCard