1

We can read the web properties using javascript object model as

var webProperties = web.get_allProperties()

and then to fetch a property value we can index it using

webProperties.get_fieldValues()["PropertyName"]

However if I have to read all the properties of the web, I cannot simply iterate it using indexes.

webProperties.get_fieldValues()[1] or webProperties.get_fieldValues().get_item(1)

does not work.

We need to know the key to be able to retrieve the value of a property. Apparantely, to fetch all the web properties, I have to log it in the console or debug and WATCH the value. Any solutions on this ?

1 Answer 1

3

You should be able to do something like the following:

var properties = webProperties.get_fieldValues();

// loop over all properties
for (property in properties) 
{
   var propertyName = property;
   var propertyValue = properties[property];

   console.log(propertyName + " - " + propertyValue);
}
2
  • doesn't work ! Did you get any result from the above code ? I have loaded the "web" object in my client query and trying to get the code working in the success handler. Of course with a "var property" in the FOR loop. Aug 7, 2015 at 9:29
  • ah well this worked..thanks. I had not loaded the properties explicitly. Cheers ! Aug 7, 2015 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.