Skip to main content

Is it possible to disable/hide the delete button in the attachments control for a group of users? They still need the ability to add and open attachments. I can only disable the whole attachments control using a rule. Thanks

there is no direct possibility, you will have to write a javascript code to achieve that.

following document might point you to right direction  


Hi Anna,

Marians link is correct. Another way do hide the delete Link would be by using css in the custom css section of the form settings but it would affect all users instead of users of a single group.

.nf-attachmentsTable tr td.ms-propertysheet,
.nf-attachmentsTable tr td.propertysheet
{display:none}


I would suggest the use of both approaches, use javascript to assess if a user is in a group and then using CSS disable / hide the delete button using the CSS above. You can use a function like the following, replacing Groupname with your group name for the users:

function CheckUserGroup(){
  var data = NWF$.ajax({
    url: "../_api/web/currentuser/groups?$select=Title&$filter=Title eq 'GROUPNAME'",
    method: "GET",
    async: false,
    headers: { "Accept": "application/json; odata=verbose" },
    success: function (data) {
          $.each(data.d.results, function(i,result) {
              $(".nf-attachmentsTable tr td.ms-propertysheet").css("display","none");

              $(".nf-attachmentsTable tr td.propertysheet").css("display","none");
      });
    },
        error: function (data) {
            alert('No Group Found');
        }
  });
}


Thank you for providing the function. I've added it to my form. When I try the form in preview mode it hides the delete attachment button. However when I publish the form and try it from the list it doesn't hide the delete button. Perhaps I am missing something?


@ctarr It worked pertectly, Than You


Reply