Created
December 20, 2018 03:40
-
-
Save Zerg00s/ad42316c9b1ee9d7a99087b62f39751d to your computer and use it in GitHub Desktop.
Get all internal field names using JavaScript
This file contains hidden or 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
async function GetFields(listTitle){ | |
let data = await fetch(`${_spPageContextInfo.siteServerRelativeUrl}/_api/web/lists/GetByTitle('Users')/Fields?$filter=Hidden%20eq%20false`, | |
{ | |
headers: {"Accept":"application/json;odata=verbose"} | |
}); | |
let fields = await data.json(); | |
console.log(fields.d.results.map(field=>`${field.Title} | ${field.InternalName}\n\r`).join("") ); | |
} | |
// pass the list name: | |
GetFields("Users") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment