Skip to content

Instantly share code, notes, and snippets.

@mikekunze
Created July 23, 2013 18:53
Show Gist options
  • Save mikekunze/6065087 to your computer and use it in GitHub Desktop.
Save mikekunze/6065087 to your computer and use it in GitHub Desktop.
This script is sample code for getting the itemType token from a SharePoint 2013 list.
user = "domain\\username"
pass = "password"
url = "http://sharepoint/siteCollection"
list = "listName"
request = require 'request'
getListTypeByTitle = (title, cb)->
processRequest = (err, res, body)->
cb(err, JSON.parse(body).d.ListItemEntityTypeFullName)
config =
headers :
Accept: "application/json;odata=verbose"
url : "#{url}/_api/web/lists/getbytitle('#{title}')?"
request.get(config, processRequest).auth(user, pass, true)
getListTypeByTitle list, (err, itemType)->
console.log err || itemType
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment