The best way to add an entry to the Edit Control Block (ECB) in SharePoint is, to implement a feature, which adds a custom action as described in the SharePoint SDK. So, implementing a feature, to add an entry to each list or library in a web is very simple.

1. Create the feature-file

<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="
http://schemas.microsoft.com/sharepoint/"
         Id="3517D4B3-57C6-4471-903C-BF1E159EBFFB"
         Title="TestCustomAction"
         Scope="Web"
         Version="1.0.0.0"
         Description="Testing the custom action in the ECB">
  <ElementManifests>
    <ElementManifest Location="elements.xml"/>
  </ElementManifests> 
</Feature>

There are no secrets within the feature-file. Its scope is set to "Web", so the feature could be activated in the web-settings.

2. Create the elements-file

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="
http://schemas.microsoft.com/sharepoint/">
  <CustomAction Id="MyCustomActionId"
                Location="EditControlBlock"
                RegistrationType="ContentType"
                RegistrationId="0x" 
                Title="My Custom Action">
    <UrlAction Url="{put your target address in here}"/>
  </CustomAction>
</Elements>

In the elements-file we have the set the location. As RegistrationId we use the System-ContentType "0x". So, we also need to set the RegistrationType to "ContentType". With these settings, the entry is added to the ECB in each list and library of the web.

With the RegistrationId it is possible, to use the entry only with specific lists or content types. Have a look into "…\12\TEMPLATE\FEATURES\ctypes\ctypeswss.xml" for the ID of the buildin content types. As an example, you can set the RegistrationId to the value "0x010102" when the entry should be added for pictures only.

Advertisements