Question

I need help as I have a requirement to get all permissions (PermissionKind Enumeration)and bind it to a drop-down. Also, I need help to know what are the different ways to bind Enumerator value using jquery.

Was it helpful?

Solution

We can use the following code to achieve it.

<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(getPermissionKinds, "sp.js");
function getPermissionKinds() {  
    $.each(SP.PermissionKind, function(key, value) {
        if($.isNumeric(value)){
            $("#PermissionKinds").append("<option value="+value+">"+key+"</option>");
        }       
    }); 
}
</script>
<select id="PermissionKinds"></select>

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top