Introduction
A Document Set is a group of related documents that can be created in one step and then managed as a single entity.
Source Code
- $(document).ready(function() {
- getDocSet('Documents','Orders',success,logError);
- });
- function getDocSet(listTitle,docSetName, success,error) {
- var context = SP.ClientContext.get_current();
- var list = context.get_web().get_lists().getByTitle(listTitle);
- var items = list.getItems(createGetDocSetQuery(docSetName));
- context.load(items);
- context.executeQueryAsync(
- function() {
- var docSetItem = (items.get_count() > 0 ? items.getItemAtIndex(0) : null);
- success(docSetItem);
- },
- error
- );
- function createGetDocSetQuery(docSetName)
- {
- var query = new SP.CamlQuery();
- var viewXml =
- "<View>" +
- "<Query>" +
- "<Where>" +
- "<And>" +
- "<Eq>" +
- "<FieldRef Name=\"FSObjType\"/>" +
- "<Value Type=\"Integer\">1</Value>" +
- "</Eq>" +
- "<Eq>" +
- "<FieldRef Name=\"FileLeafRef\" />" +
- "<Value Type=\"Text\">" + docSetName + "</Value>" +
- "</Eq>" +
- "</And>" +
- "</Where>" +
- "</Query>" +
- "<RowLimit>1</RowLimit>" +
- "</View>";
- query.set_viewXml(viewXml);
- return query;
- }
- }




Join the conversation! Your thoughts help the community grow.