Hide Controls in SharePoint based on Permissions

In this article we are able to see how to hide controls based on permissions, we placed a button in display form and we want to show that button only for couple of users, for this we created a SharePoint group  added users in that group.

Add the below code in notepad save it and place it in Site Assets.
Enter your GroupName as per your requirement.
Add the content editor in the display form, Edit it and refer the file in this editor.
Now we can able to see the button based on the permissions.

function CurrentUserInGroup()
            url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups/getByName('Your SP GroupName')/Users?$filter=Id eq " + _spPageContextInfo.userId,
            method: "GET",
            headers: { "Accept": "application/json; odata=verbose" },
            success: function(data){
            if(data.d.results[0] != undefined){       
<input type="button" id="btnhidebutton" value="Add Button"/>


SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

Lakshmi Tulasi Jasti

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment


Post a Comment