Skip to content

Instantly share code, notes, and snippets.

@cmd64
Created August 19, 2021 13:30
Show Gist options
  • Save cmd64/3761dc536c638fdad3e7a399b9f42e23 to your computer and use it in GitHub Desktop.
Save cmd64/3761dc536c638fdad3e7a399b9f42e23 to your computer and use it in GitHub Desktop.
[JS]
$.ajax({
async: false,
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists(guid'listID')/fields?$top=1000",
method: "GET",
headers: {
Accept: "application/json; odata=verbose",
},
success: function (data) {
var colStr = [];
var elements = {};
$.each(data.d.results, function (i, val) {
var title = val.Title;
var internalName = val.InternalName;
elements[internalName] = { title: title, name: internalName, form: "{{" + internalName + "}}" };
});
console.log(JSON.stringify(elements));
},
fail: function (jqXHR, status, error) {
console.log(error);
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment