Skip to content

Instantly share code, notes, and snippets.

@mikekunze
Created July 23, 2013 19:06
Show Gist options
  • Save mikekunze/6065194 to your computer and use it in GitHub Desktop.
Save mikekunze/6065194 to your computer and use it in GitHub Desktop.
This script will get the authenticated context info from a SharePoint 2013 list.
user = "domain\\username"
pass = "password"
url = "http://sharepoint/siteCollection"
list = "listName"
request = require 'request'
getListContext = (title, cb)->
processRequest = (err, res, body)->
cb(err, JSON.parse(body).d.GetContextWebInformation.FormDigestValue)
config =
headers :
Accept: "application/json;odata=verbose"
url : "#{url}/lists/#{list}/_api/contextinfo"
request.get(config, processRequest).auth(user, pass, true)
getListContext list, (err, contextToken)->
console.log err || contextToken
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment