Created
July 26, 2012 23:04
-
-
Save mikekunze/3185143 to your computer and use it in GitHub Desktop.
reportGenerator route for accessing a sharepoint 2010 list and spitting the data out with HTML
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
require 'coffee-script' | |
request = require 'request' | |
data = | |
getData: (cb)-> | |
username = 'someUser' | |
password = 'somePassword' | |
proto = 'https://' | |
site = 'sharepoint.domain.com/_vti_bin/listdata.svc' | |
config = | |
url: proto + username + ':' + password + '@' + site + '/' + 'someList?$orderby=someColumn' | |
json: true | |
request config, (err, res, body)-> | |
if err | |
console.log err | |
cb body.d.results | |
routes = | |
index: (req, res)-> | |
data.getData (dataArray)-> | |
options = | |
title: 'reportGenerator' | |
layout: 'layout.jade' | |
items: dataArray | |
res.render 'index', options | |
module.exports = routes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment