WSS 3 / MOSS Creating Views in CAML (List Definition)

I have been creating custom Lists in CAML for deployment by features.  As you do.  I found out a few things that might be of help when you are creating them yourselves.

I am  Assuming that you now how to create a list template and know what goes in a schema.xml to a point.

Concentrating solely on views here I found out this.

If you have a List View WebPArt you need one of these types of views, if you don’t LVWP don’t work.

<View BaseViewID="0" Type="HTML">….</View>

Careful of BaseViewIDs being the same.

<View DefaultView="TRUE" SetupPath="pages\viewpage.aspx" Type="HTML" DisplayName="Summary" Url="Summary.aspx" Level="1" BaseViewID="1" ContentTypeID="0x"
            ImageUrl="/_layouts/images/generic.png" WebPartZoneID="Main">

<View SetupPath="pages\viewpage.aspx" Type="HTML" DisplayName="Summary"  Url="Summary.aspx" Level="1" BaseViewID="1" ContentTypeID="0x"
            ImageUrl="/_layouts/images/generic.png" WebPartZoneID="Main">

Notice that the BaseViewID’s, that wonderful field that’s barely documented, if they are both the same number then you might get problems.  I can’t explain why, but In my views I created the second view had a different Query but was ignored when created and it copied the first views query.  When I changed the BaseViewID=2 on the second view everything worked.

Is that the right thing to do ? I can’t say I’m only commenting on what I have observed.

Don’t do this

<View DefaultView="TRUE" SetupPath="pages\viewpage.aspx" Type="HTML" DisplayName="Summary" Url="Summary.aspx" Level="1" BaseViewID="1" ContentTypeID="0x"
            ImageUrl="/_layouts/images/generic.png" WebPartZoneID="Main">

<View DefaultView="TRUE" SetupPath="pages\viewpage.aspx" Type="HTML" DisplayName="Summary"  Url="Summary.aspx" Level="1" BaseViewID="1" ContentTypeID="0x"
            ImageUrl="/_layouts/images/generic.png" WebPartZoneID="Main">

If you forget when you cut and paste if you have two default views in the "Lists" page it shows up twice, its not really there twice but looks like it is.  You may not notice till too late with this one.

 

References:http://www.binaryjam.com/2008/11/06/wss-3-moss-creating-views-in-caml-list-definition/

posted @   StarWang  阅读(221)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!
点击右上角即可分享
微信分享提示