- private DataTable MakeTable(string strUrl)
- {
- dt = new DataTable();
- dt.Columns.Add("ID");
- dt.Columns.Add("title");
- dt.Columns.Add("url");
- dt.Columns.Add("type");
- dt.Rows.Clear();
- try
- {
- folder = web.GetFolder(strUrl);
- SPQuery q = new SPQuery();
- q.Folder = folder;
- q.Query = "<OrderBy><FieldRef Name=/"Title/" Ascending=/"FALSE/"/><FieldRef Name=/"Created/" Ascending=/"FALSE/"/></OrderBy>";
- SPListItemCollection items = list.GetItems(q);
- for (int i = 0; i < items.Count; i++)
- {
- dt.Rows.Add(items[i]["ID"], items[i]["标题"], items[i].Url, items[i].ContentType.Name);
- }
- }
- catch (Exception ex)
- {
- Response.Write(ex.Message);
- }
- return dt;
- }
读取列表中指定文件夹下的数据
最新推荐文章于 2020-12-28 19:38:21 发布