I need code for adding a folder with Client Side Object Model using Custom Content Type (Folder) on SharePoint Library.
1 Answer
This script will add folder to any library:
var list = ctx.Web.Lists.GetByTitle(listName);
var folder = list.RootFolder;
ctx.Load(folder);
ctx.ExecuteQuery();
folder = folder.Folders.Add(folderName);
ctx.ExecuteQuery();
-
1It will add Folder, not custom content type of type folder. Commented Jan 21, 2016 at 9:57
-
1: That was quick; 2: Ok he want to add content type to the folder, I'll update my answer Commented Jan 21, 2016 at 9:58
-
1No, I understand he wants to add custom content type that inherits from Folder content type - but it may be the same as adding just a normal CT. Commented Jan 21, 2016 at 9:59