Skip to content

Instantly share code, notes, and snippets.

@beckettkev
Created July 24, 2015 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beckettkev/711b6e5c71e208c760dd to your computer and use it in GitHub Desktop.
Save beckettkev/711b6e5c71e208c760dd to your computer and use it in GitHub Desktop.
$.ajax({url: window.location.href.toLowerCase().split('pages')[0] + "_api/web/getFileByServerRelativeUrl('" + window.location.pathname + "')/Level",
headers: { "Accept": "application/json; odata=verbose" },
success: function(data) {
if(data.d.Level === 1) {
console.log('The file is published');
} else if (data.d.Level === 2) {
console.log('The file is in draft');
} else {
console.log('The file is checked out!');
}
console.log(data.d.Level, 'data.d.Level');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment