尝试从 nodejs 访问 SharePoint 时出现以下错误
events.js:71 抛出参数[1];// 未处理的“错误”事件 ^ 错误:在 Object.afterConnect [as oncomplete] (net.js:760:19) 的 errnoException (net.js:769:11) 处连接 ECONNREFUSED
下面是代码
var SP = require('sharepoint'),
site = //url,
username = //username,
password = //password;
var client = new SP.RestService(site),
contacts = client.list('Contacts');
var showResponse = function (err, data) {
console.log(data);
}
client.signin(username, password, function () {
// At this point, authentication is complete,
// so we can do requests.
// Example request: Get list items
// showResponse is used as callback function
contacts.get(showResponse)
});