Created
July 23, 2013 19:06
-
-
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.
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' | |
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