Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

ECMA script - retrieving SPList property bag

$
0
0

Hi

I have added a property bag to SPList. Since the SPList doesn't support property bag, I have added my custom property to SPList.RootFolder.Properties. I would like to retrieve this property using ECMA script. I couldn't find a getter method in ECMA script for SP.Folder for retrieving the properties.

I have tried the below, but this returns default properties like Name of folder and Item count, but doesn't return any other property and also custom properties that are added. I have tried rootFolder.get_properties(), but it throws exception that method is not supported.

function addToPlaylist() {
    var ctx = SP.ClientContext.get_current();
    var listId = SP.ListOperation.Selection.getSelectedList();

    //get propertybag
    var web = ctx.get_web();
    this.list = web.get_lists().getById(listId);
    this.rootFolder = list.get_rootFolder();
    ctx.load(rootFolder);
    ctx.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}

function onQuerySucceeded(sender, args) {
    this.props = this.rootFolder.get_objectData().get_properties();
}

function onQueryFailed(sender, args) {
    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}

Any help is appreciated.

Thanks



Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>