Posts

Showing posts with the label Folders

SharePoint 2010: Create a folder in Javascript

Here is some simple Javascript to create a folder and a sub folder. CreateFolder($scope, // success function(){ CreateFolder2($scope) } ); function CreateFolder($scope, success){ var clientContext;     var oWebsite;     var oList;     var itemCreateInfo;     clientContext = new SP.ClientContext.get_current();     oWebsite = clientContext.get_web();     oList = oWebsite.get_lists().getByTitle("Report");     itemCreateInfo = new SP.ListItemCreationInformation();     itemCreateInfo.set_underlyingObjectType(SP.FileSystemObjectType.folder);     itemCreateInfo.set_leafName("Top Folder");     this.oListItem = oList.addItem(itemCreateInfo);     this.oListItem.update();     clientContext.load(this.oListItem);     clientContext.executeQueryAsync(         Function.createDelegate(this, successHandler),     ...