sharepoint 读取文件夹中所有的数据
private void BindData() { SPWeb web = SPContext.Current.Web; SPList list = web.Lists["我的文档"]; SPListItemCollection items = GetItems(list); GridView1.DataSource = items.GetDataTable(); GridView1.DataBind(); } private SPListItemCollection GetItems(SPList list) { SPQuery query = new SPQuery(); query.Folder = list.RootFolder; ; query.ViewAttributes = "Scope=\"RecursiveAll\""; SPListItemCollection itemCollection = list.GetItems(query); return itemCollection; }
Scope |
可选属性,类型为 Text。指定文档库的视图的递归范围。可能的值包括:
|
参考文献:http://blog.csdn.net/chenxinxian/article/details/8425166