Thinking again............ Oh got it !!! Yes, I can add a new menu item through "customaction" feature and can navigate to the "CustomUpload.aspx" page to upload the documents. Think again ...... Yes, You can do it !! But what about the existing OOB menu item which navigates you to the OOB "upload.aspx" page. Still thinking ........ Hurray !!! Through "HideCustomAction" i will hide the existing OOB menu item in the upload menu which navigates to the OOB upload.aspx page.
Let me interrupt here !! As long the "CustomAction" feature is considered, you can add a new item under the "UploadMenu". But hiding the existing OOB menu item is not possible through the "HideCustomAction" feature. The "HideCustomAction" feature can hide the item which has been rendered through the CustomAction feature framework such as Site Action, Site Setting.... etc. Even you cannot hide the item from the "ECB" menu through HideCustomAction but can add a new menu item in the ECB menu through custom action. Because the ECB menu is rendered by the JavaScript from Core.js file. Likewise the "Upload menu" is rendered through a class library as a web control from the Microsoft.SharePoint.dll
So "HideCustomAction" feature can be used only to hide the item which are rendered through the custom action feature.
Following are some truth about the document library (as well "Lists") toolbar and the way to render the custom control in the toolbar :
1. The toolbar of the document library consists of New Menu, Upload menu, Actions Menu and Settings Menu. These menus are rendered by the sharepoint dll and not by any JavaScript.
2. To customize the Upload Menu, Create a class which inherits from the Microsoft.Sharepoint.WebControls.UploadMenu class and Override the “SetmenuItemProperties” method to navigate to the custom upload page. In this method it has been hard coded to navigate to the OOB upload.aspx.
3. The code snippet and the sample project has been attached in this post.
4. Compile the class library and place the DLL in the GAC.
5. The Rending Template for the document library is in the defaulttemplates.ascx control under 12/Template/Control template. The rendering template ID is “DocumentLibraryViewToolbar”. This template renders the New menu, Upload menu, Actions menu and Settings menu in the toolbar. The template looks like follows :
6. Modifying the OOB files are not supported so copy the defaulttemplates.ascx and save it with a custom name under 12/Template/Control Template.
7. Modify the “DocumentLibraryViewToolbar” in the custom ascx such that to render your custom upload menu from the class library you created. (Note : You need to add your assembly reference and register the tag prefix in the Custom ascx control. The sample customdefaulttemplates.ascx control is attached in this post)
8. The following are the snippet from the custom ascx control :
Along with the other existing tag prefixes need to add the tag prefix for your custom upload menu control dll
<% @Register TagPrefix="MyUpload" Assembly ="customupload, Version=1.0.0.0, Culture=neutral, PublicKeyToken=be322df48bc9f56c" Namespace="customupload" %>
9. Next step is to render the custom rendering template to the document library so that the custom upload menu will be rendered in the toolbar. For this the "ToolbarTemplate" property of the View should be changed in the schema.xml file of teh document library definition. As modifying the OOB files are not supported, Copy the “DocumentLibrary” folder from 12/Template/Features and paste in the same place as “CustomDocumentLibrary”.
10. Change the feature ID of the “CustomDocumentLibrary”
11. Open the schema.xml file of custom document library and add the “ToolbarTemplate=CustomDocumentLibraryViewToolbar” attribute to the “View BaseID=1”. The sample custom document library definition with schema.xml changes is attached in this post.
12. Install the feature and activate it.
13. Create a document library using the custom document library definition and you can test that the custom upload menu has been added to the document library toolbar.
14. Now clicking on the upload document will navigate you to the custom upload.aspx page
HAPPY CUSTOMIZING