Document Set behaving like Folder
Hi All,
There is a bug in SharePoint Javascript API to create document sets. They dont behave like document sets unless you update the ProgId of the folder.
Below is the code to fix it.
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
function updateProgId(ctx, rootFolder, docsetTitle, index, successCallback) { | |
var web = ctx.get_web(); | |
var currentFolder = web.getFolderByServerRelativeUrl(rootFolder.get_serverRelativeUrl() + "/" + docsetTitle); | |
var folderProperties = currentFolder.get_properties(); | |
folderProperties.set_item("vti_progid", "Sharepoint.DocumentSet"); | |
currentFolder.update(); | |
ctx.executeQueryAsync(function () { | |
successCallback(); | |
}, function (sender, args) { | |
failLog(sender, args, index); | |
}); | |
} |
Comments
Post a Comment