0

这个问题很清楚,我知道如何从 c# 中的属性包中读取属性

但现在我需要知道如何在 jquery 或 SPServices 中做到这一点。任何想法?

谢谢

4

1 回答 1

-2
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");
}
于 2013-11-01T20:44:15.220 回答