Created
August 19, 2021 13:30
-
-
Save cmd64/3761dc536c638fdad3e7a399b9f42e23 to your computer and use it in GitHub Desktop.
[JS]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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