0

我正在努力使用 sharepoint 客户端对象模型在站点中创建文档库。

主要思想是创建文档库,然后在每个文档库下创建子文档。

请告诉我..

谢谢卡哈尔

4

1 回答 1

0
  ClientContext clientContext = new ClientContext("your Site goes here");
  Web rootWeb = clientContext.Web;
  //Get List
  var query = clientContext.LoadQuery(rootWeb.Lists.Where(p => p.Title == "SharedFolder"));
  clientContext.ExecuteQuery();
  List list = query.FirstOrDefault();
  string[] namesArray = new string[] {  "Folder1","Folder2"};
  foreach (string name in namesArray)
   {
    //Add Folder
    var folders = list.RootFolder.Folders;
    clientContext.Load(folders);
    clientContext.ExecuteQuery();
    var newFolder = folders.Add(name);
    Console.WriteLine(name);
  }
  //Execute request
  clientContext.ExecuteQuery();
于 2012-09-14T13:11:00.503 回答