function spRest() {
var RestUrl = _spPageContextInfo.webAbsoluteUrl + "/_api/web/Lists/GetByTitle('{Title Of List/Library}')/Items?&expand=FieldValueAsText";
$.ajax({
url: RestUrl,
method: "GET",
headers:
{
"accept": "application/json;odata=verbose",
},
success: function (data) {
if (data.d.results.length > 0)
{
ReadJSON(data.d.results);
} else {}
},
error: function (data) {}
});
function ReadJSON(objArray) {
for (var i = 0; i < objArray.length; i++)
{
var AnyColumn = objArray[i].AnyColumn;
}
}
}
This is an outline for using SharePoint's REST API to get information from list/libraries in SharePoint. I recommend getting "SharePoint Insider," which is a Google Chrome Extension that lets you test SharePoint's API to test to see what is sent back from a given request.
Link to SharePoint Insider:
https://chrome.google.com/webstore/detail/sharepoint-insider/gjckpigahcbffmeofjfedlffddhfidhj?hl=en
Link to SharePoint Insider:
https://chrome.google.com/webstore/detail/sharepoint-insider/gjckpigahcbffmeofjfedlffddhfidhj?hl=en
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.