Hide Parts of a Page from Certain Users in SharePoint

 Dec 03, 2015

In general, to manipulate a page’s behaviour in SharePoint you normally add a Content Editor web part to the page, and write appropriate JavaScript in it to accomplish the behaviour.

To further allow this behaviour to be exhibited only for some users you set the web part’s target audience to a group of users. Here, we learn how to achieve this. The behaviour we are concerned with here is hiding attachments from certain groups of users in DispForm.aspx, but of course, you can extend this to any other behaviour.

DispForm.aspx is the page that is called when you view properties of a list item. On this page you normally see data for each field.

If you don’t want to show a specific field, you can simply go to the Edit Page mode, insert a Content Editor web part to the page and then add an appropriate JavaScript to the web part to hide a row.

However, as mentioned before, you can write your own code to perform what you want (don’t forget to save the page).

If you now show the page in SharePoint you’ll notice that no one will be able to see attachments when they view the properties of a list item.

To hide it from only certain users, first create a Group that includes those users and then key in the name of the group in the Target Audience section of the Web Part. To get to the Target Audience section you need to be in Edit mode of the page. Show the Content Editor web parts’ Properties task pane and go to the bottom of Advanced section. There you’ll see the Target Audience.

If you'd like more information, take a look at New Horizons' SharePoint training courses.

How do your Excel skills stack up?   

Test Now  

About the Author:

Cyrus Mohseni  

Having worked within the education and training industry for over 15 years as well as the IT industry for 10 years, Cyrus brings to New Horizons a wealth of experience and skill. Throughout his career he has been involved in the development and facilitation of numerous training programs aimed at providing individuals with the skills they require to achieve formal qualification status. Cyrus is a uniquely capable trainer who possesses the ability to connect with students at all levels of skill and experience.

Read full bio
top