I know how to make multiple/different calls to get details about all the fields and views in a list but I was wondering if there is a way to do it with one call.
I know I can use get_fields()
and get_views()
to get the fields/views but then I have to iterate them and make a 2nd call to load all the details.
I figured I can use get_schemaXml()
to get the list schema but that doesn't include all the views and their schema.
function doIt()
{
var clientContext;
var oWebsite;
var oList;
var schema;
clientContext = new SP.ClientContext.get_current();
oWebsite = clientContext.get_web();
oList = oWebsite.get_lists().getByTitle("Announcements");
clientContext.load(this.oList, "SchemaXml");
clientContext.executeQueryAsync(
Function.createDelegate(this, successHandler),
Function.createDelegate(this, errorHandler)
);
function successHandler(sender, args) {
console.log(this.oList.get_schemaXml());
}
function errorHandler(sender, args) {
console.log(args);
}
}
doIt()