I'm trying to have an image show up within a webpart based on the authorization group of a user.

Is there a way to assign a specific audience to an image within a WebPart rather then the entire WebPart?


  • what do you mean with image show up based within a webpart ? what's the type of this web part ? by the way, the audience applied at the entire web part. – Mohamed El-Qassas MVP Sep 20 '16 at 12:59

You can use SPSecurityTrimmedControl in webpart design file,

<Sharepoint:SPSecurityTrimmedControl runat=”server” Permissions=”ViewPages”>
//Only users with ViewPages permissions will be able to see this content.
<img src="test.gif" alt="test" height="42" width="42">

SPSecurityTrimmedControl which performs the security trimming of the child controls inside it. Just include our control inside this control and it will be displayed or hidden based on the permission specified.

Here is detail example http://www.c-sharpcorner.com/UploadFile/40e97e/security-trimmed-control-in-sharepoint-2013/

| improve this answer | |
  • Thanks! This is very useful. Instead of displaying the image based on a specific permission, is there a way to have it displayed using the group ID? – Fred Sep 20 '16 at 14:39
  • We can not add sharepoint group in SPSecurityTrimmedControl. this thread may help you. sharepoint.stackexchange.com/questions/112337/… – SP Developer Sep 20 '16 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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