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.
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.
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"]