javascript/jquery to create a document set
-
09-12-2019 - |
Question
i have seen several SOM examples online for programmatically creating a document set, but I would need to accomplish this with javascript/jquery if possible. Is this possible, and if so how is it done (reference)?
Thanks very much for any assistance
Solution
I don't think you can do that directly.
What you can do is to use the /_layouts/Upload.aspx page and use an ajax file uploader.
What I would do:
- Use an third part ajax file uploaded such as valums / file-uploader.
Find the ID of your library (list).
var title = 'D'; var ctx = new SP.ClientContext(); var list = ctx.get_web().get_lists().getByTitle(title); ctx.load(list); ctx.executeQueryAsync(function() { var id = list.get_id().toString(); // Use id here });
Use the found ID to tell where to post your files, something like
/_layouts/Upload.aspx?List={XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
And take it from there, if you open that url and include &IsDlg=1
it should be possible to see how it accepts data.
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange