Monday, October 27, 2008

Adding Navigation to ECB as Feature

Adding Navigation to Document Library Menu.

There are number of scenarios that you have to link document library item to custom application page with the list id and the item id. There are two option that have for this.

1. Adding Content Query Web Part ( now i cannot remember how to do this)
2. Adding feature as Custom Action to the ECB.

im going to discuss about how to do it using feature.

In here im writing element.xml it is up to you define the feature and the activate it inside the farm.


<customaction id="MyApplication.ECBItemMenu"
registrationtype="List"
registrationid="101"
location="EditControlBlock"
sequence="105"
title="MyApp Page">

<urlaction url="~site/_layouts/CustomApplicationPages/ApplicationPage4.aspx ?ItemId={ItemId}&ListId={ListId}">
</urlaction>

</customaction>


But this ECB menu will appier only to the document library items. If you need this add to list item, you have to extend this using "Item" content type id. This figure show you content type ids for the base content types in the SharePoint. What you have do is change your "registrationtype" and "registrationid".




This will add this ECB menu to your custom list.


<customaction id="MyApplication.ECBItemMenu"
registrationtype="ContentType"
registrationid="0x010"
location="EditControlBlock"
sequence="105"
title="MyApp Page">

<urlaction url="~site/_layouts/CustomApplicationPages/ApplicationPage4.aspx ?ItemId={ItemId}&ListId={ListId}">
</urlaction>
</customaction>


This are the examples of them


We can add ECB menu to the Dislpay, Edit item form also.

No comments: