如何使用jquery或SPServices从FARM属性包中读取属性

时间:2013-10-30 19:49:50

标签: javascript jquery sharepoint spservices

问题非常明确,我知道如何从c#

中的属性包中读取属性

但现在我需要知道如何在jquery或SPServices中执行此操作。有什么想法吗?

由于

1 个答案:

答案 0 :(得分:-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");
}