SharePoint Feature Activation Form

蹲街弑〆低调 提交于 2020-01-03 03:26:07

问题


I'd like to collect some information from a user when they activate a feature on a site. Just like the WF Association form when you add a workflow to a list.

My particular scenario is a feature that creates a timer job that will do a weekly export of a document library as PDFs to a special staging database. When the feature is activated I'd like to ask the user for the connection string of the database, the source document library and the interval between updates.


回答1:


I do not know of a way to do this when the feature is activated.

I think you would need to include an administration page in your feature to allow the user to enter the configuration information required, which the feature would then refer to. Perhaps you could also add a task entry with a link to the new admin page as a bit of a guide when the feature is activated.




回答2:


I don't think you can interact with a user during feature activation. Feature events are fired server-side and you can't display a page to users in this process.

I would create a custom ASPX page that a user can visit to enter the connection string and other settings for your job. Once this page is submitted you can create a new instance of your timer job with the custom settings.

There's an example of how to do this on MSDN: Creating Custom Timer Jobs in Windows SharePoint Services 3.0, specifically in the section titled Deploying Custom Timer Jobs and sub-heading Custom Applications.




回答3:


You can do this, but it's not the best idea. 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. If you enable the feature using the web interface, then you can technically do a response.redirect to some custom page when the feature is activated. That custom page could then collect some information from the user and then activate the feature. Your feature activation code would have to check some web property or something to see if the user has supplied the necessary data, and if not, redirect the user to your custom page.



来源:https://stackoverflow.com/questions/1130731/sharepoint-feature-activation-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!