How to bind SP.PermissionKind Enumeration to a dropdown list using jquery
-
23-01-2021 - |
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.
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>
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange