Last active
October 6, 2016 18:06
-
-
Save phillipharding/e42364c7792552b09134 to your computer and use it in GitHub Desktop.
Create Document Set using JSOM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var clientContext = null; | |
function createTestDocumentSet() { | |
if(clientContext === null) { | |
return false; | |
} | |
var item = null; | |
var oList = clientContext.get_web().get_lists().getByTitle('Library Name'); | |
clientContext.load(oList); | |
var itemCreateInfo = new SP.ListItemCreationInformation(); | |
itemCreateInfo.set_underlyingObjectType(SP.FileSystemObjectType.folder); | |
itemCreateInfo.set_leafName('Documentset Name'); | |
item = oList.addItem(itemCreateInfo); | |
item.set_item("ContentTypeId", "0x0120D520"); | |
item.set_item('Title', 'Documentset Name'); | |
item.update(); | |
clientContext.load(item); | |
clientContext.executeQueryAsync( | |
function() { console.log("document-set created!");} , | |
function(sender,args) { console.log("Doh... " + args.get_message()); } | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment