Software Technology Tips

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 
          This is the content type id for the list.
      2. Now if you want to get it programatically then you can use this one:
Now we need to create the feature.xml file :
       <?xml version="1.0" encoding="utf-8" ?>
          <Feature Id="{0af0c758-9ed9-43c8-aa2f-90a6fe879c9d}" 
                Title="Custom Menu"
                Description="This example shows how you can implement custom menu."
                      <ElementManifest Location="Element.xml" />
  Here  id is the feature id which is a GUID.

  Scope is web, which means the feature will be available to all the subsites also

  Hidden is false, which means the feature will be visible in the feature list for a site (Where you can activate the feature)
Next: Create the Element.xml file:
       Here we need to add a custom action .
<?xml version="1.0" encoding="utf-8" ?>
        <Elements xmlns="">
              <CustomAction  RegistrationType="ContentType"   RegistrationId="0x0100F310C1F224701541BF37AFD23D67FEAC" 
              Sequence="1000"  Location="ViewToolbar" Title="Test"> 
                    <UrlAction Url="/path to navigate"/>
Here the RegistrationId is the content type id of the list  and Url is the path to navigate when the user clicks the button.

Related Tags:


Author: Premananda Das

Related Pages

  • SharePoint Development Skills
  • SharePoint Application Projects


Let us Connect!

Awards and Achievements

Red Herringcolor DeloitteFast50 DB ZInnov1   Nascome  DB Stpi

This site uses cookies. We respect your privacy.copyright (c) Mindfire Solutions 2007-2015. Login