ECMA tagged posts

ECMA SharePoint 2010 – Checkout and Checkin with JavaScript

Category: #SharePoint Comments: No comments

With ECMA in SharePoint 2010 you can do things that normally – if you want to achieve programmatically – the costs time and money for the client.
One example is to set the CHECKOUT and CHECKIN status of a page. Few lines of JavaScript code and you’re done…

function checkOut(){
        var ctx = SP.ClientContext.get_current();
        var page = ctx.get_web().getFileByServerRelativeUrl(window.location.pathname);
        page.checkOut();
        ctx.load(page);
        ctx.executeQueryAsync(Function.createDelegate(this, checkOut_Success),
                                            Function.createDelegate(this, checkOut_Fail));
}
function checkOut_Success(sender, args){
        alert(‘i am good’);
}
function checkOut_Fail(sender, args){
        alert(‘something wrong happened…’);
}

function

Read More