How to check if the SharePoint page is in Draft version or not using REST API -SharePoint 2013?

In this blog, I will give you the piece of code to check if  the sharepoint page is draft version  or not using REST API’s. Below is the piece of code to achieve the same.

$.ajax({url: “/_api/web/getFileByServerRelativeUrl(‘” + pageUrl + “‘)/Level”,
headers: { “Accept”: “application/json; odata=verbose” },
success: function(data) {
if(data.d.level== 2) {
alert(‘your page is already in Draft mode’);

else

{

alert(“your page is not in  Draft mode”);

}
}
}
});

Do check out the below articles on

Check if the SharePoint page is checked out or not using REST API -SharePoint 2013

Set the Search Centre URL in SharePoint 2013 Using Javascript

Get-the-list-of-user-profiles-in-office-365

How to set the Client People Picker value in SharePoint 2013.

Retrieving Query Results by Date Range in SharePoint Site 2013 Using REST SEARCH API

Share you SharePoint Site to External User in SharePoint Online /Office 365

Differences between Search features in SharePoint 2010 vs 2013/Office 365

Happy SharePointing Folks!! Hope it helps you guys!!

Leave a Reply

Your email address will not be published.