简体   繁体   中英

Set the Category/group for webpart on deployment using WSPBuilder

I have developed an event handler,called TaskListEventHandler, for the Task list ((ItemAdding, ItemDeleting, ItemUpdating) as feasture using the WSP Builder project template, and I have also added a web part, called RegisterEventHandler, which will be used to bind(register) the events to a list. The webpart is WSP Builder template "Webpart without feature".

Currently, on deployment, my feature and the webpart is getting deployed sucessfully. The web part is also available in the web part gallery.

Now i need to make the web part available in a particular category/group in the gallery using the WSP Builder?

I tried setting the group in the RegisterEventHandler.webpart file (which is automatically created by WSP builder on adding the webpart template inot the project), but still it doesn't show up :(

Cannot import RegisterEventHandler Web Part. RegisterEventHandler This webpart is used to register or unregister the event handler to the task list - By Biju (09 Sep 2009) Biju Webparts

Could anyone please help or suggest me some solution or sample code?

Like Per says.. if you add a webpart feature with wspbuilder it will give you an elements.xml file. This contains an entry like this:

<File Url="WPName.webpart" Type="GhostableInLibrary">
    <Property Name="Group" Value="MyGroup" />
    <Property Name="QuickAddGroups" Value="QuickGroup" />
</File>

Where the properties determine what group is used in the library. Mind you if this web part is already activated in your site re-activating it again wil often not overwrite the existing registration; you'll have to delete the .webpart file from the web part library first.

The category/group of a web part is specified in the elements.xml file (Groups property).

But as Janis comments it seems a little odd to add a web part to add a EventHandler.

If you just want to add the eventhandler to all tasklists on the site where you activate the feature then you can do the add in elements.xml directly.

If you want to add it to a special task list then you can do it in an FeatureReceiver.

If you want to give the enduser the option of selecting which list to add it to then a the web part might be ok, but an application page would probably be a more "SharePoint" way of doing it, or use SPEvent Handler Manager from codeplex

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM