0

This question already has an answer here:

Someone know how to get value of a property bag with JSOM? I do this with C# code :

string anchorIdTheme = SPContext.Current.Web.GetWebProperty(WebProperties.NETWORK_THEME_NODE, string.Empty);

I want to do same thing with JSOM.

marked as duplicate by Robert Lindgren Sep 23 '16 at 8:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

Use the following script to adapt to your needs. This gets all Web properties.

var webProperties;

function getWebProperties() {
    var clientContext = new SP.ClientContext.get_current();
    webProperties = clientContext.get_web().get_allProperties();
    clientContext.load(webProperties);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.getWebPropertiesSucceeded), Function.createDelegate(this, this.onQueryFailed));
}

function getWebPropertiesSucceeded() {
    var allProps = webProperties.get_fieldValues();

    var customProp = "";

    if(webProperties.get_fieldValues().CustomSite_Version != undefined)
    {
        var customProp = webProperties.get_fieldValues().CustomSite_Version;
    }
}

function onQueryFailed(args, sender)
{
     //handle errors
}

If you want a specific property, use this:

webProperties.get_fieldValues()["YouProperty"]
  • Thanks, I tried it but I get "undefined" when I do : webProperties.get_fieldValues()["NetworkThemeNode"]) – WWWWWWWWWP Sep 22 '16 at 9:07
  • I mistyped the code and included an unnecessary parenthesis at the end. Make sure that is removed in your code. – Paul Strupeikis Sep 22 '16 at 9:10

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