Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm attempting to access items in a DocumentSet using SharePoint 13's JSOM. I am able to access the generic list properties but I do not see how to access ContentType specific properties on the client side. I have a DocumentSet with PDF's and I need the Name property of the items in the DocumentSet.

function GetContentItem() {
      context = new SP.ClientContext.get_current();
      lstStudents = context.get_web().get_lists().getByTitle('My Asset Library');
      web = context.get_web();
      currentUser = web.get_currentUser();
      context.executeQueryAsync(Function.createDelegate(this, this.onSuccessMethod),
                              Function.createDelegate(this, this.onFailureMethod)); 

function onSuccessMethod(sender, args) {
       var camlQuery = new SP.CamlQuery();

       camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name="Title" /><Value Type="Text">' + getTitle() + '</Value></Eq></Where></Query></View>');
       this.ContentListItems = lstStudents.getItems(camlQuery);
       context.executeQueryAsync(Function.createDelegate(this, this.showContentData),

//This where I am confused. I do not understand how to access the properties of
//'list' within the DocumentSet

function showContentData()
        var listItemEnumerator = ContentListItems.getEnumerator();
        var mainContainer = document.getElementById('mainContentContainer');

        while (listItemEnumerator.moveNext()) {
            var div = document.createElement('DIV');
            var oListItem = listItemEnumerator.get_current();
            div.innerHTML += 'ID: ' + oListItem.get_id() + 
                'Title: ' + oListItem.get_item('Title');
            div.innerHTML += '<br/>' + oListItem.get_folder();


share|improve this question

1 Answer 1

The following example demonstrates how to access files in Document Set:

SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function() {

    var docSetUrl = '/Documents/2013';  //Document Set named 2013 in Documents library
    var ctx = SP.ClientContext.get_current();
    var ds = ctx.get_web().getFolderByServerRelativeUrl(docSetUrl);
       function () {
           //print file names in Document Set
           for(var i = 0; i < ds.get_files().get_count();i++){
               var file = ds.get_files().get_item(i);
       function (sender, args) {
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.