Part 1: Installing Features and Adding Breadcrumbs to Custom Pages in Sharepoint Central Administrat

This article explains step by step how to install features, how to add custom pages and how to add custom bread crumbs to the above web pages in SharePoint Central Administration 2007.

Part 1: Installing features and adding breadcrumbs to custom web pages in SharePoint Central Administration

Steps to be followed:

  1. Creating and installing features in Central Administration.
  2. Creating and placing custom web pages in Central Administration.
  3. Adding breadcrumbs to above custom web pages in Central Administration.

Create Feature.xml and CustomBreadCrumbs.xml

  1. Create folder (CACAdminPages) in [Installation Drive]/Program files/Common Files/Microsoft Shared/web server extensions/12/Template/Features/
  2. Create Feature.xml and CustomBreadCrumbs.xml in [Installation Drive]/Program files/Common Files/Microsoft Shared/web server extensions/12/Template/Features/ CACAdminPages
              feature.xml 
    
         <Feature Id="7030911B-BB77-4152-9254-96FEC3F312BB"
                  Title="CAC Administration"
                  Description="CAC Administration"
                  Version="12.0.0.0"
                  Scope="Site"
                  AutoActivateInCentralAdmin="True"
                  ActivateOnDefault="False"
                  AlwaysForceInstall="True"         
                  xmlns="http://schemas.microsoft.com/sharepoint/">
    
         <ElementManifests>
                   <ElementManifest Location="CustomBreadCrumbs.xml"/>
         </ElementManifests>
      </Feature>
    
  3. The Id in above feature.xml file is the GUID value
    1. Open Visual studio
    2. Go to Tools menu and select "Create GUID" menu item.

      The Create GUID screen

    3. Select the default option "Define GUID" as given in the above screen and click ok
  4. The auto generated GUID should be copied and pasted in the Id value of the Feature.xml file.
  5. Feature.xml refers to the other xml file CustomBreadCrumbs.xml in the location property of ElementManifest tag.
  6. Create CustomBreadCrumbs.xml
      
         CustomBreadCrumbs.xml
    
          <?xml version="1.0" encoding="utf-8"?>
        <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
        <CustomActionGroup Id="CcAdministration"
                      Location="Microsoft.SharePoint.Administration.Operations"
    	      Title="Custom Breadcrumb"
    	      Sequence="1000" />
        <CustomAction Id="Management" 
                GroupId="CcAdministration"                                                 
                Location="Microsoft.SharePoint.Administration.Operations"          
                Sequence="10"
                Title="Navigate To Page 1">
          <UrlAction Url="/_admin/CACAdminPages/CustomPageOne.aspx"/>
        </CustomAction>
    <CustomAction Id="Management" 
                GroupId="CcAdministration"                                                 
                Location="Microsoft.SharePoint.Administration.Operations"          
                Sequence="10"
                Title=" Navigate To Page 5">
          <UrlAction Url="/_admin/CACAdminPages/CustomPageFive.aspx"/>
        </CustomAction>	
        </Elements>
    

    1. Id of CustomActionGroup tag (ie CcAdministration should be same as the GroupId of CustomAction tag)
    2. Location property of CustomActionGroup tag is used to specify where the links should appear. In the above example it appears in Operations tab of Central Administration.
    3. Title that is given in CustomActionGroup tag ie "Custom Breadcrumb" appears as header under Operations tab.
    4. The text that is given in the Title property of the CustomAction tag is the name of the hyperlink which appears under "Custom Breadcrumb".
    5. The above xml code displays the hyperlinks in Central Administration Operations tab as shown in the screen "Hyperlinks screen"
    6. Two Hyperlinks named "Navigate To Page 1" and "Navigate to Page 5" are displayed under "Custom Breadcrumb" header. On click of the "Navigate to Page 5" hyperlink CustomPageFive.aspx opens as Url property of UrlAction tag is set to CustomPageFive.aspx.

      NOTE: We need to add the aspx pages to refer in the Url property of the UrlAction tag. That we can see in the next step. For time being lets assume that we have the aspx pages already created.

    7. Install the feature.xml file in order to make the hyperlinks appear as shown in the above image. Navigate to [Sharepoint Installation Drive]\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN in Visual Studio Command Prompt and then execute the below command to install the feature.
      Stsadm -o installfeature -name [folder name] { which we have created to place the feature.xml and CustomBreadCrumbs.xml, in our case it is Custom Breadcrumb}

      NOTE: To uninstall the feature forcefully
      Stsadm -o uninstallfeature -name [folder name] -force

    8. Now check whether the hyperlinks are appearing in the Central Administration.As the aspx pages are not yet created don't click on hyperlinks otherwise displays error message.

Part 1: Installing Features and Adding Breadcrumbs to Custom Pages in Sharepoint Central Administrat

II.Creating Custom Web Pages

  1. Open Visual Studio web application project, and add the code for web pages in the way a page needs to be navigated.
  2. In this sample we took 5 pages- CustomPageOne.aspx, CustomPageTwo.aspx, CustomPageThree.aspx, CustomPageFour.aspx and CustomPageFive.aspx. On click of the first hyper link "Navigate To Page 1", initially calls the CustomPageOne.aspx and the pages are navigated as defined below:

    Page 1 to Page 2
    Page 2 to Page 3 and Page 4
    Page 3 to Page 2
    Page 4 to Page 2 and Page 3

    So CustomPageOne.aspx is called in the first CustomAction Tag of "CustomBreadCrumbs.xml"
  3. Page 5 is an individual page which is called on click of the second hyperlink "Navigate to Page 5". So CustomPageFive.aspx is called in the second CustomAction Tag of "CustomBreadCrumbs.xml".

    [PageHierarchy.JPG]
  4. Download the attached web application and build the solution.
  5. Copy the web application dll and paste it in the below path - [Sharepoint Installation Drive] / Inetpub/wwwroot/ WSS /VirtualDirectories/ [AdminPortNo.]/bin
  6. Create a folder (CACAdminPages) in [Sharepoint Installation Drive]/Program files/Common Files/Microsoft Shared/Webserverextensions/12/Template/ Admin

    NOTE: Use the same folder name in the Url property of the UrlAction tag of the "CustomBreadCrumbs.xml".
  7. Copy all five aspx pages from the downloaded web application and paste them in CACAdminPages folder.

    Add the sharepoint master pages in all five aspx pages.

    Sample: (for CustomPageOne.aspx)
    <%@ Page MasterPageFile="~/_admin/admin.master"  AutoEventWireup="true"
       Inherits="BreadCrumbSample._Default"   
        Language="C#"%>
    
    <asp:Content 
        contentplaceholderid="PlaceHolderPageTitle" runat="server">
    First Page
    </asp:Content> 
    
    <asp:Content 
        contentplaceholderid="PlaceHolderPageTitleInTitleArea" 
        runat="server">
     <asp:Button ID="btnNavSecPage" runat="server" onclick="btnNavSecPage_Click" 
            Text="NavigateTo Second Page" />  
    </asp:Content> 
    
    <asp:Content 
        contentplaceholderid="PlaceHolderMain" 
        runat="server">
    Welcome to First Page!
    </asp:Content>
    

    Check the downloaded "Modified" folder for other aspx pages.
  8. Browse the Central Administration url and check whether the hyperlinks which are created in the previous steps are opening and navigating to the correct pages.

Part 1: Installing Features and Adding Breadcrumbs to Custom Pages in Sharepoint Central Administrat

III. Adding Breadcrumbs

For custom pages breadcrumbs are not displayed by default and can be added in the following ways:

  1. Editing the admin.sitemap file
    1. Admin.sitemap file is located in the following path:

      C:\Inetpub\wwwroot\wss\VirtualDirectories\[Site Port No.]\_app_bin
    2. Open the admin.sitemap file from the above location and add the below at "/_admin/operations.aspx" sitemap node.
             
      <siteMapNode url="/_admin/CACAdminPages/CustomPageOne.aspx"                                   
                parentUrl="/_admin/operations.aspx" title="First Page">
             <siteMapNode url="/_admin/CACAdminPages/CustomPageTwo.aspx"
                  title="Second Page">
                  <siteMapNode url="/_admin/CACAdminPages/CustomPageThree.aspx" 
                      title="Third Page"/>
                  <siteMapNode url="/_admin/CACAdminPages/CustomPageFour.aspx" 
                      title="Four Page"/>
             </siteMapNode>
      	</siteMapNode>
      	<siteMapNode url="/_admin/CACAdminPages/CustomPageFive.aspx"   
                parentUrl="/_admin/operations.aspx" title="Fifth Page"/>
      
  2. Automerge:
    This is the best and recommended way to add breadcrumbs in custom web pages in the live environment. It is an automated way to deploy in any number of front end servers.
    1. Create an xml file as "admin.sitemap.*.xml" (naming convention should be followed, replace "*" with some name. Eg: admin.sitemap.custombreadcrumb.xml) with the below structure in the path-
      [Sharpoint Installation Drive]\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\ADMIN

      admin.sitemap.custombreadcrumb.xml:
               <?xml version="1.0" encoding="utf-8"?>
               <siteMap enableLocalization="true">
           <siteMapNode url="/_admin/CACAdminPages/CustomPageOne.aspx"                                   
                    parentUrl="/_admin/operations.aspx" title="First Page">
            <siteMapNode url="/_admin/CACAdminPages/CustomPageTwo.aspx"
                  title="Second Page">
                  <siteMapNode url="/_admin/CACAdminPages/CustomPageThree.aspx" 
                      title="Third Page"/>
                  <siteMapNode url="/_admin/CACAdminPages/CustomPageFour.aspx" 
                      title="Four Page"/>
             </siteMapNode>
      	     </siteMapNode>
      	     <siteMapNode url="/_admin/CACAdminPages/CustomPageFive.aspx"   
                   parentUrl="/_admin/operations.aspx" title="Fifth Page"/>
               </siteMap>
      
    2. Execute the following command in the Visual Studio Command prompt to merge this newly created sitemap file with the existing admin.sitemap file.

      stsadm -o appbincontent

      NOTE: Instead of hard coding the titles(like First Page) in the newly created sitemap file better to place them in resource files

    3. Now open the path-
      [Sharepoint Installation Drive]\Inetpub\wwwroot\wss\VirtualDirectories\[Site Port No.]\_app_bin to check whether the admin.sitemap file contains the newly added sitemap file code.

      [BreadCrumb.JPG]
  3. Creating a label(lblName) in the master page (admin.master) in [Sharepoint Installation Drive] \Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\ADMIN
    Then in codebehind files of aspx file assign the label with the appropriate breadcrumb text(like Central Administration > Operations > First Page)

    Master.FindControl("lblName").Text= "Central Administration > Operations > First Page"

Watch for part 2 of this article.

Thanks a lot.
Happy coding.

http://ambatisreedhar.spaces.live.com
http://ambatisreedhar.wordpress.com



About the Author

ambati sreedhar

am Sreedhar Ambati working as a senior software engineer in Proteans Software Solutions Pvt ltd (www.proteans.com) Bangalore. Proteans a CAMO group company is an outsourcing company focusing on software product development and business application development on Microsoft Technology Platform. "Committed to consistently deliver high-quality software products and services through continual improvement of our knowledge and practices focused on increased customer satisfaction."

Downloads

Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • This paper introduces IBM Java on the IBM PowerLinux 7R2 server and describes IBM's implementation of the Java platform, which includes IBM's Java Virtual Machine and development toolkit.

  • Get Gartner's NEW Magic Quadrant for Solid-State Arrays. Selecting new storage or just researching? Simplify your vendor evaluation with Gartner's 2014 Magic Quadrant for Solid-State Arrays. This report covers: Strengths & cautions for 12 vendors Assessment of each vendor's completeness of vision and ability to execute Key criteria for evaluating Solid-State Array vendors

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds