Reading all properties of web using Javascript object model
-
04-10-2020 - |
문제
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 ?
해결책
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);
}
제휴하지 않습니다 sharepoint.stackexchange