Created
July 23, 2013 18:53
-
-
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.
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
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