Skip to content

Instantly share code, notes, and snippets.

@wictorwilen
Created January 30, 2015 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wictorwilen/0497cc0ab8e3097e1b00 to your computer and use it in GitHub Desktop.
Save wictorwilen/0497cc0ab8e3097e1b00 to your computer and use it in GitHub Desktop.
Remove a field programatically from a list using JSOM
var context = SP.ClientContext.get_current()
var web = context.get_web()
var lists = web.get_lists()
var list = lists.getByTitle('Test') // Replace with title of list
var cols = list.get_fields()
var col = cols.getByInternalNameOrTitle('XYZ') // replace with title or internal name of column
col.deleteObject()
context.executeQueryAsync(
function(){
alert('Done')
},
function() {
alert('Error')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment