2

I have a Content Editor WebPart Where Audience Targetting is set to all users.But I need to hide it from Few groups.

Problem is These groups are part of NTAuthority/all user group.Please suggest something how to go ahead with this.

1
  • Did you consider aggregating all these groups and users into one SharePoint group, and hiding it with audience targetting on the web part?
    – user19105
    Jan 30, 2015 at 21:08

2 Answers 2

5

This is a common problem and the answer is another CEWP:

Steps:

  1. Create the group or audience of people to hide things from

  2. Note the ID of the web part you want to hide (F12)

  3. Write a bit of CSS to hide the web part
  4. Add a Content Editor Web Part to hold or link to the CSS and audience filter it

The CSS to hide the web part would be something like this:

<style type="text/css">
#MSOZoneCell_WebPartWPQ2
{
    display:none;
}
</style>

More detailed explanation here: http://techtrainingnotes.blogspot.com/2012/06/sharepoint-hide-web-part-for-selected.html

2
  • This is a very smart approach to the problem, I've been using it ever since. Aug 25, 2017 at 15:05
  • @CodeAbaddon Glad it helped! Aug 28, 2017 at 0:58
0

When you define the groups in the audience targeting of the web part itself, you only have the option to choose which groups to include. You can't exclude users by group membership per se. Meaning, if you choose all users, you cannot exclude some of them based on membership.

The same goes for audiences managed in the User Profile Service Application. You can define audience membership by group membership. However, you can exclude people in an audience by their profile properties. You could, for instance, exclude users of a certain Department (by what their Department profile property says).

Your best course of action here would be to define an audience in the User Profile Service Application and only include people in specific groups, not all users. Then use that audience when configuring your web part. Using audiences in the UPA usually performs better when dealing with a large number of groups (since the membership is compiled on a schedule rather than on the fly).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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