SharePoint: How to apply ViewStyle in schema.xml

When you are customizing a SharePoint list with a custom schema.xml file, you may also want to set the ViewStyle for your View.

You do that by adding a <ViewStyle ID="xx"/> element within the <View> element. For exampl ID 17 corresponds to the "Shaded" view style.

Here’s a table with the common ViewStyles available, as defined in the <12 HIVE>\TEMPLATE\GLOBAL\XML\VWStyles.xml

0 Basic Table
12 Boxed, no labels
13 Boxed
15 Newsletter
16 Newsletter, no lines
17 Shaded
20 Preview Pane
0 Default

One thought to “SharePoint: How to apply ViewStyle in schema.xml”

  1. Hi Magnus,

    About your post, i am developing a very little SharePoint features with powershell(and after on c#) who ensures 2 things :
    1 – Toggle all GenericList views and all DocLibrary views on viewStyle “Shaded” when my feature is actived(Event Receiver).
    $view.ApplyStyle($web.ViewStyles.StyleByID($intShaded)); //$inShaded = 17 of course ^^
    $view.Update()
    2 – Toggle all GenericList views and all DocLibrary views on viewStyle on viewStyle Default when my feature is desactived(Event Receiver).
    My question is simple. What is the integer value for “default” (StyleId) viewstyle ? It cannot be 0, because when i try to put 0, i have a “Basic Table” viewStyle that is different than “Default” styleID.

    In advance, sorry for my english faults and thank you for your return.
    Alexandre, from France.

Leave a Reply

Your email address will not be published. Required fields are marked *