views:

26

answers:

2

I have created a SharePoint web part which has custom properties that the user can configure. However these apply only to that instance of the web part. How could I provide the user a place to allow the user to set properties that would apply to every instance of the web part?

(I'm new to SharePoint development and am using WSPBuilder to create a web part with a feature and deploy it.)

A: 

It has been a bit since I used SharePoint... the first thing I would try is to create a List whose records are the parameters you want to feed to the webpart, and configure it so that the users can only see/modify their own record.

Caveats: this may be tricky if you want to make records dynamically appear whenever a new user registers. And also, lists are "local" to the site, so you can't have a single list which is seen from parts in different sites. (Or at least this is how it worked in SP 2007).

Depending on the number of parameters you need to properly configure the webpart you could also play around with custom "fields" in the user profile, but this is not very robust and would probably be an overkill.

p.marino
+2  A: 

You could use the Property bag of the SPSite's RootWeb (or, to make it SPWeb specific, the current SPWeb) to store global settings for that webpart (in that specific site collection). Create a LAYOUTS page to allowing editing of these settings if it's site collection wide, use RunWithElevatedPrivileges to store properties in an SPWeb's property bag.

Colin
+1 - See this answer for more info including the "Hierarchical Configuration Manager" that is part of the production ready MS Guidance Libraryhttp://stackoverflow.com/questions/3008473/what-is-a-proper-way-to-store-site-level-global-variables-in-a-sharepoint-site/3014277#3014277
Ryan