locked
add new menu item, toolbar RRS feed

  • Question

  • I want to add a new menuitem in the toolbar.

    i have a document library, on the allItems.aspx.

    i want to add a new menuItem called "CustomUpload".

    because i wont call the noral upload.aspx but a customized.

    i have create a feature.xml, elements.xml.

    on the elements.xml i have a <UrlAction url="/test library/Forms/CustomUpload.aspx" />

    and than the stsadm instal en active ...

    but when i click on the item, the url is not good created.

    what is the problem.

     

    or are there any outher ideas?

    • Moved by Mike Walsh FIN Tuesday, June 8, 2010 7:19 AM feature (From:SharePoint - Design and Customization (pre-SharePoint 2010))
    Monday, June 7, 2010 8:52 PM

Answers

  • Step by Step process of creating a new Custom Document Library

    1. Navigate to Custom 12/Template/Features
    2. Copy DocumentLibrary Folder and rename to CustomDocumentLibrary
    3. Edit Feature.xml file in CustomDocumentLibrary Folder.
        1. Change the Tile and Description value to your own.
        2. Create a new GUID using GUID-Gen Tool - available under Tool Menu
            
       This is result of above step.
       
       <?xml version="1.0" encoding="utf-8"?>
    <Feature Id="{D1A8F5CB-1C72-4a4a-AC94-0196E9230150}" 
        Title="Custom Doc Lib"
        Description="My Custom Doc Lib"
        Version="1.0.0.0"
        Scope="Web"
        Hidden="TRUE"
        DefaultResourceFile="core"    
        xmlns="http://schemas.microsoft.com/sharepoint/">
        <ElementManifests>
            <ElementManifest Location="ListTemplates\DocumentLibrary.xml" />
        </ElementManifests>
    </Feature>


    4. Open DocumentLibrary.xml File

        Make changes to following properties

       1. Type,DisplayName,Description
          - Make sure the Type value is greater than 1000. I would recommend you to refer the ListTemplate CAML in SDK for other 
       properties details

       here is the sample after modification. Save and close the xml file.
       
       <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
        <ListTemplate
            Name="doclib"
            Type="4000"
            BaseType="1"
            OnQuickLaunch="TRUE"
            SecurityBits="11"
            Sequence="110"
            DisplayName="Custom Document Library"
            Description="My Custom Document Library"
            Image="/_layouts/images/itdl.gif"
            DocumentTemplate="101"/>
    </Elements>

    5. Navigate to DocLib Folder and open schema.xml file for editing.

      Update the Title in List node, keep the rest of the document unchanged. (Save and close)
      
      sample
      
      <List xmlns:ows="Microsoft SharePoint" 
    Title="Custom Document Library;" 
    Direction="$Resources:Direction;" 
    Url="Shared Documents" 
    BaseType="1">
    ....
    ....  [ Ommitted for Clarity ]
    ...
       </List>
      

    6. Open Command Prompt.

    execute the following command (I'm assuming that STSADM is confiured for env path)

    ---- Installing Feature ----
    C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES>stsadm -o installfeature -name customdocumentlibrary

    ---- Acitvating Feature at Localhost ----
    C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES>stsadm -o activatefeature -name customdocumentlibrary -url http://localhost

    iisreset

    7. This will create a Custom Document Library link and will be available in your Create Page.
    8. This document library has a new Type ID i.e. 4000 and you can apply custom Link in Tool Bar and lots more.

     
    9. For a proper deployment you can use WSP builder for packaging, building and deploying WSP Package and feature.
       WSP Builder LINK : http://wspbuilder.codeplex.com/
       How to Integrate it with VS 2008 - http://www.zimmergren.net/archive/2009/04/08/wspbuilder-walkthrough-of-the-visual-studio-add-in.aspx
       

    10. Sorry for such long steps...Enjoy :-)



    Custom Link on View Toolbar

    <CustomAction

        Id="UserInterfaceCustomActions.DisplayFormToolbar"

        RegistrationType="List"

        RegistrationId="4000"

        Location="ViewToolbar"

        Sequence="200"

        Title="Custom Upload">

        <UrlAction Url="www.google.com"/>

      </CustomAction>




       

    Thanks
    Akhilesh Nirapure
    • Marked as answer by kimvlas Monday, June 14, 2010 7:33 AM
    Monday, June 14, 2010 5:07 AM

All replies

  • Can u share your Elements.xml
    Thanks
    Akhilesh Nirapure
    Thursday, June 10, 2010 7:07 AM
  • Make Sure you are setting the Location as "ViewToolbar"

     

    Sample Code

     

    <CustomAction

        Id="UserInterfaceCustomActions.DisplayFormToolbar"

        RegistrationType="List"

        RegistrationId="101"

        Location="ViewToolbar"

        Sequence="200"

        Title="Custom Upload">

        <UrlAction Url="www.google.com"/>

      </CustomAction>


    Thanks
    Akhilesh Nirapure
    Thursday, June 10, 2010 7:38 AM
  • thats correct i have the same thing,

    <?xml version="1.0" encoding="utf-8" ?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <!-- Document Library Toolbar Upload Menu Dropdown -->
      <CustomAction Id="UserInterfaceCustomActions.DisplayFormToolbar"
        RegistrationType="List"
        RegistrationId="101"
        Rights="ManagePermissions"
        Location="ViewToolbar"
        Sequence="200"
        Title="handmaked Upload Document">
        <UrlAction Url="http://testpc/sites/production/products/Forms/EditForm2.aspx"/>
      </CustomAction>
    </Elements>

    when i install the feature with cmd :).

    the button appears ons every document library, is it possible that i place this button ownly on 1 document library and not on every library?

    is it olso possible that the urlaction url= can be maked dynamic, like:

    javascript:var surl='{SiteUrl}'; Source=surl+/test form/Forms/EditForm2.aspx.

    this line is not corret but i think you see what i meen.

    greetz,

    kim

    Thursday, June 10, 2010 11:24 AM
  • Yes you can have Custom Action for Specific Document Library, for that you need 2 create a Custom Document Library so then you can specify the RegistrationID="YourCustomDocumentLibraryID".

    You can use Url Tokens like {SiteUrl}.

     

    You have mentioned the Rights value so check if you are checking with the user who has this permission.

     


    Thanks
    Akhilesh Nirapure
    Thursday, June 10, 2010 11:35 AM
  • how do i create a custom document library?

    is this different with a normal document library?

    Thursday, June 10, 2010 12:14 PM
  • Kimvlas

     

    Quick search gave me this link, go through it

     

    http://vspug.com/tbaginski/2007/08/16/creating-a-custom-document-library-feature-in-wss-v3-moss-2007/

     

    Its simple process, same as you create a Custom List, (Via XML & Feature)

     


    Thanks
    Akhilesh Nirapure
    Thursday, June 10, 2010 3:14 PM
  • when i then create a new custom document libvrary with the custom document library as template i recieve a server out of memory.

    sharepoint run's at the moment on a virtual machien with 2.4 gb of memory.

    when i click in the create " custom document library", and a wordt templet it works.

    when i then activate the feature on my documentg library like this : stsadm -o activatefeature -filename CustomUserToolbar/feature.xml -url http://..../products

    products i my custom document library.

    on this document library is it not showned, but when i create a normal library then i will see my custom button.

    whats wrong?

    Friday, June 11, 2010 11:49 AM
  • Hello

    Check this article, hope this helps you

    http://www.as-tech.co.uk/post/Adding-menu-item-to-single-list.aspx

    Monday, June 14, 2010 3:15 AM
  • Step by Step process of creating a new Custom Document Library

    1. Navigate to Custom 12/Template/Features
    2. Copy DocumentLibrary Folder and rename to CustomDocumentLibrary
    3. Edit Feature.xml file in CustomDocumentLibrary Folder.
        1. Change the Tile and Description value to your own.
        2. Create a new GUID using GUID-Gen Tool - available under Tool Menu
            
       This is result of above step.
       
       <?xml version="1.0" encoding="utf-8"?>
    <Feature Id="{D1A8F5CB-1C72-4a4a-AC94-0196E9230150}" 
        Title="Custom Doc Lib"
        Description="My Custom Doc Lib"
        Version="1.0.0.0"
        Scope="Web"
        Hidden="TRUE"
        DefaultResourceFile="core"    
        xmlns="http://schemas.microsoft.com/sharepoint/">
        <ElementManifests>
            <ElementManifest Location="ListTemplates\DocumentLibrary.xml" />
        </ElementManifests>
    </Feature>


    4. Open DocumentLibrary.xml File

        Make changes to following properties

       1. Type,DisplayName,Description
          - Make sure the Type value is greater than 1000. I would recommend you to refer the ListTemplate CAML in SDK for other 
       properties details

       here is the sample after modification. Save and close the xml file.
       
       <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
        <ListTemplate
            Name="doclib"
            Type="4000"
            BaseType="1"
            OnQuickLaunch="TRUE"
            SecurityBits="11"
            Sequence="110"
            DisplayName="Custom Document Library"
            Description="My Custom Document Library"
            Image="/_layouts/images/itdl.gif"
            DocumentTemplate="101"/>
    </Elements>

    5. Navigate to DocLib Folder and open schema.xml file for editing.

      Update the Title in List node, keep the rest of the document unchanged. (Save and close)
      
      sample
      
      <List xmlns:ows="Microsoft SharePoint" 
    Title="Custom Document Library;" 
    Direction="$Resources:Direction;" 
    Url="Shared Documents" 
    BaseType="1">
    ....
    ....  [ Ommitted for Clarity ]
    ...
       </List>
      

    6. Open Command Prompt.

    execute the following command (I'm assuming that STSADM is confiured for env path)

    ---- Installing Feature ----
    C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES>stsadm -o installfeature -name customdocumentlibrary

    ---- Acitvating Feature at Localhost ----
    C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES>stsadm -o activatefeature -name customdocumentlibrary -url http://localhost

    iisreset

    7. This will create a Custom Document Library link and will be available in your Create Page.
    8. This document library has a new Type ID i.e. 4000 and you can apply custom Link in Tool Bar and lots more.

     
    9. For a proper deployment you can use WSP builder for packaging, building and deploying WSP Package and feature.
       WSP Builder LINK : http://wspbuilder.codeplex.com/
       How to Integrate it with VS 2008 - http://www.zimmergren.net/archive/2009/04/08/wspbuilder-walkthrough-of-the-visual-studio-add-in.aspx
       

    10. Sorry for such long steps...Enjoy :-)



    Custom Link on View Toolbar

    <CustomAction

        Id="UserInterfaceCustomActions.DisplayFormToolbar"

        RegistrationType="List"

        RegistrationId="4000"

        Location="ViewToolbar"

        Sequence="200"

        Title="Custom Upload">

        <UrlAction Url="www.google.com"/>

      </CustomAction>




       

    Thanks
    Akhilesh Nirapure
    • Marked as answer by kimvlas Monday, June 14, 2010 7:33 AM
    Monday, June 14, 2010 5:07 AM
  • i have done the samething like you but i have missed adjusting 1 thing.

      RegistrationId="4000"

    i havend changed the registrationid, now its working fine.

     

    thanks,

    kim


    Monday, June 14, 2010 7:36 AM
  • When we want to add a custom button to a list toolbar we can add it by using a feature.But when we are activating the feature it will be apply to  the scope secified, so all the lists present inside the scope will have a button added to it's toolbar. But if we want to add the button to a particular list then we need to specify the content type ID of the list.

     To get the content type id of a list we need to follow these steps:
     
           1.   go to the list =>Settings=>List Settings=>Advance Settings=>click yes to the allow management content type
                =>ok=>Now in the list setting page you will see a content type click the content type =>In the url you will see a value like 
         
                     "ctype=0x010046759B602A72384BB7F4C50DEA9EE828"
     
              This is the content type id for the list.
        
          2. Now if you want to get it programatically then you can use this one:
     
                  oSPWeb.Lists["listname"].ContentTypes[0].Id.ToString();
     

    Cheers, Eliza
    Thursday, June 17, 2010 12:03 PM