CSOMNode
CSOMNode copied to clipboard
Example doesn't work
Hi! I've tried to run the example:
var csomapi = require('csom-node');
var settings = {
url: "SP Online Url",
username: "login",
password: "password"
};
csomapi.setLoaderOptions({url: settings.url}); //set CSOM library settings
var authCtx = new AuthenticationContext(settings.url);
authCtx.acquireTokenForUser(settings.username, settings.password, function (err, data) {
var ctx = new SP.ClientContext("/"); //set root web
authCtx.setAuthenticationCookie(ctx); //authenticate
//retrieve SP.Web client object
var web = ctx.get_web();
ctx.load(web);
ctx.executeQueryAsync(function () {
console.log(web.get_title());
},
function (sender, args) {
console.log('An error occured: ' + args.get_message());
});
});
But it doesn't work. Nothing happens. Tried the debugger and found that execution stucked at ctx.executeQueryAsync call. Neither success nor fail calbacks called.
My mistake, used http instead of https.
Greetings,
Good to know it works for you!