我正在努力使用sharepoint客户端对象模型在站点中创建文档库。
主要思想是在每个文档库之后创建文档库,我们将创建子文档。
请告诉我..
由于 卡扎尔
答案 0 :(得分: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();