Thursday, February 5, 2015

Significance of BaseViewID="0" in schema.xml for SharePoint List Definition

Whenever you create a SharePoint List Definition in Visual Studio the schema.xml file contains two entries for View.

<View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE">

<View BaseViewID="1" Type="HTML" WebPartZoneID="Main" 
      DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" 
      DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" 
      SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" 
      Url="AllItems.aspx">

Note that one of the views has BaseViewID="0" while other one has BaseViewID="1". The view with BaseViewID set to 1 is the default view with Url set to AllItems.aspx. But the view with BaseViewID set to 0 has no Url attribute set. Any modification for BaseViewID="1" gets reflected on the default view but I couldn’t figure out where the BaseViewID="0" view was being used. Even MSDN documentation is not very clear about it. A bit puzzled about this I posted this question on SharePoint StackExchange and was pointed to this answer which explains the reason for this additional view.

The view with BaseViewID="0" is actually the summary view. In the file 14/TEMPLATE/LAYOUTS/XSL/vwstyles.xsl you can see a lot of other values of BaseViewID and their respective meanings. For BaseViewID="0" you see the following comment.

<!-- BaseViewID = 0 is summary view (home page view)-->

BaseViewID="0" is intended for using in views which are added to home page. It is intended not restricted, so you can use the summary view even on other pages. So any modifications in view with BaseViewID="0" will only be seen in summary view. Edit your List webpart and you can see the summary view over there.

No comments:

Post a Comment