After the Success of the Check in, the Page should re-load and make sure that its been checked in.
Steps:
Steps:
- Open your SharePoint site and add a CEWP.
- Then Copy the below Code and call this function on button click.
- <script type="text/javascript">
- function checkIn_Success(sender, args)
- {
- window.location.reload();
- }
- function checkIn_fail(sender, args)
- {
- alert('Checkin Failed');
- }
- function checkIn()
- {
- var ctx = SP.ClientContext.get_current();
- var web = ctx.get_web();
- var page = web.getFileByServerRelativeUrl(window.location.pathname);
- var listItem = page.get_listItemAllFields();
- //We can set any value to any of the property by the below lines.
- //listItem.set_item('PublishingPageContent', '{Updated with ECMA}');
- listItem.update();
- page.checkIn();
- page.publish();
- ctx.executeQueryAsync(Function.createDelegate(this, checkIn_Success),Function.createDelegate(this, checkIn_fail));
- }
- </script>
Thanks For reading my blogs!!!.

Former memberPosted Feb 2, 2016, 10:03 AM
More STOLEN content: http://www.sharepointpals.com/post/How-to-Checkin-and-CheckOut-in-SharePoint-2013-using-Javascript
Gowtham RajamanickamPosted Jul 3, 2015, 6:06 AM
Thanks u
Vijay SPosted Jun 17, 2015, 8:55 AM
Nice