1

Right now I get the information from a video like this:

var ctx = new SP.ClientContext(siteUrl);
var site = ctx.get_site();
var web = site.openWeb(webUrl);         
var folder = web.getFolderByServerRelativeUrl(folderUrl);
var file = folder.get_properties(); 

ctx.load(web, 'Url');
ctx.load(file);

ctx.executeQueryAsync(
    Function.createDelegate(this, function(sender, args){
        var item = file.get_fieldValues();
        var video = { 
                title: item.item.vti_title,
                description: item.item.VideoSetDescription,
                likes: item.item.LikesCount || 0
            }
        ...
    }), 
    Function.createDelegate(this, function(sender, args) {
        ...
    })
);

I need to set the Like for that video now with something like this:

Microsoft.Office.Server.ReputationModel.Reputation.setLikesetLike(context,
                        listid,
                        itemId, !liked)

How I get the values needed for the set?

Thanks

0

Done it, this its the code:

function(siteUrl, webUrl, relativeFileUrl, itemDetails) {
    var ctx = new SP.ClientContext(siteUrl);
    var site = ctx.get_site();
    var web = site.openWeb(webUrl);         
    var folder = web.getFolderByServerRelativeUrl(relativeFileUrl);
    var file = folder.get_properties(); 
    var item = folder.get_listItemAllFields();  // <-- New
    ctx.load(web, 'Url');
    ctx.load(item);
    ctx.load(file);
    ctx.load(folder)  // <-- New
    ctx.executeQueryAsync(
        Function.createDelegate(this, function(sender, args){
            // success
            //console.log("Success");
            console.log(ctx);
            var video = { 
                title: item.item.vti_title,
                description: item.item.VideoSetDescription,
                likes: item.item.LikesCount || 0,
                id : item.get_id() // <--
            }
        }), 
        Function.createDelegate(this, function(sender, args) {
            // error
            ...
        })
    );
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.