I had some code similar to this one for getting data from property bag.
However, I am getting some error that my variables are undefined. Even site
and web
are shown as undefined.
What could be the issue?
P.S: My variables usrname
and psword
are defined globally.
My code is below:
function getPropertyValues(){
var curSite = getCurrentSite();
var context = new SP.ClientContext.get_current();
var web = context.get_web();
var propertyBag = web.get_allProperties();
context.load(propertyBag );
context.executeQueryAsync(Function.createDelegate(this, this.getWebPropertiesSucceeded), Function.createDelegate(this, this.getWebPropertiesFailed));
}
function getWebPropertiesSucceeded() {
usrname = propertyBag.get_fieldValues()["ClientId"];
psword = propertyBag.get_fieldValues()["ClientSecret"];
}
function getWebPropertiesFailed(args, sender)
{ //handle errors here }