Skip to content

Instantly share code, notes, and snippets.

@vgrem
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vgrem/a7f0d08867d0b09e5fc8 to your computer and use it in GitHub Desktop.
Save vgrem/a7f0d08867d0b09e5fc8 to your computer and use it in GitHub Desktop.
Getting SP.List properties using SharePoint REST
function getJson(url)
{
return $.ajax({
url: url,
type: "GET",
contentType: "application/json;odata=verbose",
headers: {
"Accept": "application/json;odata=verbose"
}
});
}
function getListProperties(listTitle) {
var listEndpointUrl = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('" + listTitle + "')/SchemaXml";
return getJson(listEndpointUrl).then(
function(data){
var schemaXml = data.d.SchemaXml;
return schemaXml2Json(schemaXml);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment