1

Possible Duplicate:
Grab a specific property bag using ECMA script

I would appreciate if some paste a sample code to get the property bags values using ClientContext?

Geek
  • 545
  • 1
  • 13
  • 29
  • Could you please write some more text explaining what this is really, about, so we can use it to help eachother better in the future. That would be awesome :-) –  Jun 18 '12 at 11:14
  • it was a duplicated post and already been answered. – Geek Jun 18 '12 at 11:55

2 Answers2

3

Just to complete the answer provided in the link. If your property bag value is a plain text, not a serialized xml settings (as in the other question), you can use get_item function directly:

function getWebPropertyValue(key) {
    var ctx = SP.ClientContext.get_current()
    var web = ctx.get_web()
    var props = web.get_allProperties()
    ctx.load(props)
    ctx.executeQueryAsync(function() {
        var value = props.get_item(key);
        alert(value);
    }, function() {alert("failed");})
}

//test
getWebPropertyValue("vti_approvallevels");
Anatoly Mironov
  • 5,750
  • 2
  • 29
  • 56
0

There was recent discussion here regarding the very same topic. Refer to this thread: Grab a specific property bag using ECMA script

Vardhaman Deshpande
  • 10,462
  • 1
  • 26
  • 52