在Sharepoint中如何共享其他网站中的列表 之补充1
2007-12-31 17:17
267 查看
这篇文章/article/4678852.html
描述了两种方法,最终都要采用了SPD,下面这种方法完全采用代码实现:
SPView有一个RenderAsHtml方法,利用这个方法可以方便的输出任意一个List的内容。而且SPView本身是支持配置的,我们可以在界面
上方便的配置要显示的字段,排序方式等。所以只要取到SPView,就实现了我们共享任意列表数据的目的:
SPSite site = new SPSite("http://jyserver:9000/Lists/AAAA/AllItems.aspx");
SPList list = site.RootWeb.GetListFromUrl("http://jyserver:9000/Lists/AAAA/AllItems.aspx");
SPView view = list.DefaultView ;
//or SPView view = list.Views["ViewName"];
string html = view.RenderAsHtml();
把以上代码嵌入页面或WebPart即可。
描述了两种方法,最终都要采用了SPD,下面这种方法完全采用代码实现:
SPView有一个RenderAsHtml方法,利用这个方法可以方便的输出任意一个List的内容。而且SPView本身是支持配置的,我们可以在界面
上方便的配置要显示的字段,排序方式等。所以只要取到SPView,就实现了我们共享任意列表数据的目的:
SPSite site = new SPSite("http://jyserver:9000/Lists/AAAA/AllItems.aspx");
SPList list = site.RootWeb.GetListFromUrl("http://jyserver:9000/Lists/AAAA/AllItems.aspx");
SPView view = list.DefaultView ;
//or SPView view = list.Views["ViewName"];
string html = view.RenderAsHtml();
把以上代码嵌入页面或WebPart即可。
相关文章推荐
- 在Sharepoint中如何共享其他网站中的列表 之补充1
- 在Sharepoint中如何共享其他网站中的列表?
- 在Sharepoint中如何共享其他网站中的列表?
- 在Sharepoint中如何共享其他网站中的列表?
- 在Sharepoint中如何共享其他网站中的列表?
- 在Sharepoint中如何共享其他网站中的列表?
- 使用C#如何访问SharePoint网站上的列表
- Sharepoint共享文档库,如何通过Event Handler实现跨网站访问
- 在SharePoint页面中如何显示来自其他网站的List
- 在SharePoint页面中如何显示来自其他网站的List
- 在SharePoint页面中如何显示来自其他网站的List
- 在C#开发中如何使用Client Object Model客户端代码获得SharePoint 网站、列表的权限情况
- 共享本人收集的流氓网站列表
- 如何查看网站的pr值是否劫持其他网站的?
- 如何“删除”SharePoint列表的Title字段
- 如何在SharePoint Server中整合其他应用系统?
- SharePoint【整合Crystal Report水晶报表】-- 02. 如何在Sharepoint2010网站中整合Crystal Report水晶报表(显示数据 二)
- SharePoint2010 使用Designer开发工作流 --如何引用其他列表的查阅项
- SharePoint如何将使列表不被爬网爬到。
- 如何将sharepoint列表中choice类型的值绑定到dropdownlist上