如何创建显示Share point server 2007中所有视图的视图
提前致谢
答案 0 :(得分:1)
我为这是多么粗暴道歉,但它应该有希望指出你正确的方向。我不确定您是要为整个网站集还是单个网站执行此操作,因此我针对单个网站执行此操作,但此片段可以展开。
完成设置后:
SPListCollection lists = web.Lists; //Get all lists in the site
SPList viewsList = web.Lists["ViewsList"]; //Get reference to the list ViewsList
foreach(SPList list in lists) //Iterate over all of the lists in the site
{
SPViewCollection views = list.Views; //Get all of the views associated with the current list
foreach(SPView view in views)
{
SPListItem newItem = viewsList.Items.Add(); //create item object to add to list.
newItem["List Name"] = list.Title; //populate columns
newItem["View Name"] = view.Title;
newItem.Update(); //add item to list
}
}