Pregunta

The question its very clear, I lknow how to read a property from the property bag in c#

But now I need to know how to do it in jquery or with SPServices. Any idea?

Thanks

¿Fue útil?

Solución

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.getPropertyBagSuccess), function.createDelegate(this, this.getPropertyBagFail));
}

function getPropertyBagSuccess() {
    var propertyBag = webProperties.get_fieldValues();
    if(propertyBag.YourProperty != undefined)
    {
        alert(propertyBag.YourProperty);
    }
    else
    {
        alert("property not found!");
    }
}

function getPropertyBagFail(args, sender)
{
    alert("error trying to read propertybag");
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top