Going to Web Part Gallery we can see a list of Web Parts. Clicking on "Edit" we can see a couple of settings that can be changed. Can I add my own settings here, so they can affect all the instances of that web part?

this what I want to change:

Basically I need a specific setting that can only be changed by the administrator. And when I insert that web part I want to be able to access that setting. Is this possible?

  • 1
    First thing - this is from the web part gallery, changes here cannot affect instances of web parts on pages, because as a web part is added, a copy of its definition is made then added to the page. – James Love Sep 17 '13 at 18:26
  • 1
    Second, you can add custom properties to add here as fields (I think it's supported for the web Part Gallery anyway, it might not be, I need a second opinion here), but if you can, you can't security trim on individual fields in a list - SharePoint simply doesn't support field-level security. However, the web part gallery is normally only available to users of a certain privilege level anyway. – James Love Sep 17 '13 at 18:27
  • Okay, but I want the web part to access a property when inserted. This property should be defined by a user like an Administrator. That's why I thought this could be the right place to define "global" settings for my web part. This is getting hard to accomplish as the documentation doesn't really help. But thanks anyway! – nhenrique Sep 18 '13 at 8:35

This is only possible for custom-developed web parts. If there is a web part that your team has developed that you want more options for, this is indeed possible, otherwise there is no way to add more properties to existing web parts.

  • yes, it's a developed web part. I just wanted some tips on how to get there (files or code/classes) ..I can only find stuff about web part properties, not about web part "admin properties" – nhenrique Sep 17 '13 at 16:48
  • You can develop a custom ToolPart that will render the actual controls for web part properties. In this, you can then look at the permissions of the current user and decide whether or not to render the ToolPart. Some example code (doesn't include the permissions bit though, but gets you started with custom ToolParts: nothingbutsharepoint.com/sites/devwiki/articles/Pages/…) – James Love Sep 17 '13 at 16:50
  • You want your logic to check the permissions in the GetToolParts() method. – James Love Sep 17 '13 at 16:53
  • thank you for your answer. I already knew about custom tool parts, but that is when you Edit the Web Part after inserting it. I added an image of what I wanted to explain. – nhenrique Sep 17 '13 at 16:59

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.