CSOMNode icon indicating copy to clipboard operation
CSOMNode copied to clipboard

Example doesn't work

Open tarurar opened this issue 10 years ago • 2 comments

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.

tarurar avatar May 16 '16 17:05 tarurar

My mistake, used http instead of https.

tarurar avatar May 16 '16 19:05 tarurar

Greetings,

Good to know it works for you!

vgrem avatar May 17 '16 06:05 vgrem