Question

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 ?

Était-ce utile?

La solution

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);
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top