Thursday, 6 September 2012

Feature Using the Custom Action Pages

In the above example (http://www.blogger.com/blogger.g?blogID=403610387301840191#editor/target=post;postID=5161020807956575523) I used the public site URL Action elements. In this example use own ASPX pages as target.
For this feature, create a Feature.xml file and Manifest file that adds a new link to the Site Settings Galleries section.
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
            Id="4C652168-BBCE-4B2A-BA02-B66814B272B8"
            Scope="Site"
            Title="Content Type Hierarchy Pages sample"
            Description="Show the Hierarch content type page sample"
            >
     <ElementManifests>
           <ElementManifest Location="Elements.xml"/>
     </ElementManifests>
</Feature>

Create the Elements.Xml file
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
     <CustomAction Id="9AE49699-675D-4DB8-8082-81C832E52D9B"
                       GroupId="Galleries"
                       Location="Microsoft.SharePoint.SiteSettings"
                       Sequence="0"
                       Title="Site Content type Hierarchy Pages."
                       Description="Display Site content Hierarchy of site content pages.">
           <UrlAction Url="_layouts/TestPage.aspx"/>
     </CustomAction>
</Elements>


Create a TestPage.aspx and place into this location “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS”
Example TestPage.aspx code as follows
<%@ Page Language="C#"  %>
<%@ Assembly Name="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="Microsoft.SharePoint.WebControls" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <% Response.Write("This is my custom page testing .."); %>
    </div>
    </form>
</body>
</html>
Install the feature, and activate the feature à Once you activated the feature, You will find a New link in the Galleries of the top level site settings.
 

No comments:

Post a Comment