Friday, 1 July 2011

Multiple list instances of list definition


Recently, I observed one weird thing in my SharePoint application.I was creating a list definition which had multiple views. I wanted to create one instance of the site definition but I could see multiple list instances of the same list in my site.


I figured out the reason behind this issue.

In schema.xml under the views node I had multiple views definitions.
I had created one view and replicated the same for rest of the views.

<View DisplayName="By Customer Name" DefaultView="TRUE" BaseViewID="1" Type="HTML" MobileView="TRUE" MobileDefaultView="TRUE" ImageUrl="/_layouts/images/generic.png" XslLink="main.xsl" WebPartZoneID="Main" Url="By Customer Name.aspx" SetupPath="pages\viewpage.aspx">
<Toolbar Type="Standard" />
<RowLimit Paged="TRUE">100</RowLimit>

I was modifying the query and fieldrefs. Erroneously DefaultView="TRUE" attribute was present in all the views, which was resposible for creating multiple instances of the list and keeping that particular view as the default view.

No comments:

Query List/Document Library in Specific Folder

To query SharePoint List or Document Library in specific Folder “ FolderServerRelativeUrl ” as part of the CAML Query Code Snippet ...