I need to create java script which will show me the alert like Versioning is enabled or not for that document library when user open any document library.
Please let me know how I can achieve this by using java script any reference
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityAdd content editor webpart on list view web page and add below code snippet
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script><script>
$(document).ready(function () {
$listName = ctx.ListTitle;
$siteurl = _spPageContextInfo.webAbsoluteUrl;
var url = $siteurl+"/_api/web/lists/getbytitle('"+$listName+"')?$select=EnableVersioning"
getData(url).done(function (data) {
console.log(data.EnableVersioning);
if(data.EnableVersioning)
{
alert("Versioning is enalbe");
}else
{
alert("Versioning is not enabled")
}
})
})
getData = function (url) { return $.getJSON(url); };
</script>