Document Set is a hybrid between a folder and a list item. Document Sets are a feature in SharePoint Server 2013 that enables an organization to manage a single deliverable, or work product, which can include multiple documents or files. A Document Set is a special kind of folder that combines unique Document Set attributes, the attributes and behavior of folders and documents, and provides a user interface (UI), metadata, and object model elements to help manage all aspects of the work product.
More details.
Before creating Document Set we need to activate the Document Set feature in site collection level. I already explained how to work on this document in my article.
There is no limit on the number of documents that can exist in a Document Set. However, display load times may be limited by the list view threshold which by default is set at 5,000 items.
Create Simple Hosted app in office 365 ,follow the below steps to configure this.
Click the NAPA Tool in SharePoint developer site and choose SharePoint 2013 Template,
Then click the save button. This the default .aspx page in the app.
Check this default App.js page in that ADD-IN.
Copy the attached code and paste it in the app.js file.
Then select the General tab like below,
Choose permissions on the table .And give full access to the list.
After saved the App Package. Click publish Button.
After you published the App it will be available in App packages place.
Click Deploy App button to deploy this,
Click Trust it button to accept this app,
Click Create Document Set button and check this library.Documetn set has been created.
Code:
- 'use strict';
- varhostweburl;
- varappweburl;
- vardocSetContentTypeID = "0x0120D520";
- (function()
- {
-
-
- $(document).ready(function()
- {
-
- hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
- appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));
- });
- })();
- functiongetQueryStringParameter(paramToRetrieve)
- {
- varparams = document.URL.split("?")[1].split("&");
- for (var i = 0; i < params.length; i = i + 1)
- {
- varsingleParam = params[i].split("=");
- if (singleParam[0] == paramToRetrieve) return singleParam[1];
- }
- }
- functioncreatedocumentset()
- {
- varctx = new SP.ClientContext(hostweburl);
- varparentFolder;
- varnewDocSetName = "Test"
- var web = ctx.get_web();
- var list = web.get_lists().getByTitle('Documents');
- ctx.load(list);
- parentFolder = list.get_rootFolder();
- ctx.load(parentFolder);
- vardocSetContentType = ctx.get_site().get_rootWeb().get_contentTypes().getById(docSetContentTypeID);
- ctx.load(docSetContentType);
- ctx.executeQueryAsync(function()
- {
- SP.DocumentSet.DocumentSet.create(ctx, parentFolder, newDocSetName, docSetContentType.get_id());
- ctx.executeQueryAsync(success, error);
- },
- error);
- }
-
- function error(message)
- {
- return function(sender, args)
- {
- alert(message + ": " + args.get_message());
- }
- }
-
- function success(message)
- {
- return function()
- {
- alert(message);
- }
- }