SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been looking to wrap security around web parts. I already have security wrapped around documents so only the correct people see the allowed documents. The problem lies when a user does not get to see any documents they have just a header for a web part. Is there any way to hide web parts based on location, security group, or some other form?

share|improve this question

Maybe setting Target Audience for web part will help you to solve this issue.

share|improve this answer
+1 Audience targeting is the out of the box way to solve this. However, if you're using the "free" version of SharePoint then it is not available.… – Kit Menke Aug 26 '11 at 14:50

If You are using System.Web.UI.WebControls.WebParts.WebPart class then You can try with setting this.Hidden = true in Your code when You want to hide the whole Web Part under some conditions

share|improve this answer

You can try webpart audiences, they really annoys me, because hides WP to administrators too, if they are not in audiences groups :o)

share|improve this answer

Audiences may not be the answer, as it requires you (in case of SP2010) to have the user profile service running. In addition to that, audiences are showed to people who are in that audience. I guess that it's possible that people do belong to an audience, but don't see any documents. If that's not the case (so people who are in an audience, can see the documents) that will be a solution ;)

share|improve this answer

One of the difficulties with Audiences is that the content will load for everyone and only show it to people who are in the audience. If you want true security, and you want to use it on a heavily used page, then I would always show the web part and then put some kind of true security check and only provide output when they have access.

share|improve this answer

I have a couple suggestions.

  1. If you can set permissions on the list instead of the list items, the list view web part will not show for users that do not have permission to the list. I would suggest this method, becuase item level security is hard to manage and maintain.
  2. If you must use item level permissions, you can change the header so it doesn't show for everyone. If you need a header for the people who see documents, you can use SharePoint Designer to modify the XSLT of the List View Web part and show your own header.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.