tags:

views:

34

answers:

1

I would like to know if there is a way to prompt the user when activating/deactivating a feature within SharePoint.

The background behind this is that I have a SharePoint solution that deploys several configuration files that are modified by the user when deployed to the site. I would like to either allow the user to decide whether or not to overwrite the files when activating or deactivating a feature.

Thanks guys!

+1  A: 

Do you need this to work on ANY feature that is activated in your site, or just on features that are developed by you? If this is the latter case, you can add an event handler (SPFeatureReceiver) to your feature and catch the feature activated event.

EDIT: As per @Muhimbi's comment I finally understood the question - you want to allow user edit some properties and only then to activate the feature. In this case, I would suggest to define the feature as "hidden", so it does not show up in "web features" and "site features" list. Then create a custom page for "administration" of this feature, which would allow the user to override the settings in question etc. Then, register this administration page with SharePoint (again, deployed as a feature, these two features may be stapled together). Quote a good article about it can be found here: http://www.tonstegeman.com/Blog/Lists/Posts/Post.aspx?ID=13

EDIT2: found a similar article here on SO: http://stackoverflow.com/questions/1130731/sharepoint-feature-activation-form
One of the responses gives a good point - "The problem is, you don't always know where your feature activation code is going to run. If you turn on the feature using stsadm, it will execute in stsadm.exe, not the web process."

naivists
How would you use this to prompt the user?
Muhimbi
thanks @Muhimbi for noticing, I didn't get the idea that some more user input is required. I'll update my answer
naivists