How to work with features in SharePoint?

How to work with features in SharePoint? Feature deployment and activation in sharepoint

Feature is used to give some enhancement in SharePoint site.

Please follow below steps to use feature in SharePoint site.
Paste these two .xml files in below location.
C:Program FilesCommon FilesMicrosoft Sharedwebserver extensions12TEMPLATEFEATURESmyfolder
Here is both .xml files.

feature.xml (code)
<?xml version=”1.0″ encoding=”utf-8″ ?>
<Feature xmlns=”http://schemas.microsoft.com/sharepoint/”
Id=”5DFD12AF-D0AA-4c63-8FB8-C49DB1191083″
         Title=”My Custom Action Feature”
         Description=”Adds Custom Actions to the Web Site.”
         Scope=”Web”
         Version=”1.0.0.0″ >
<ElementManifests>      
<ElementManifest Location=”element.xml”/>  
</ElementManifests>
</Feature>

element.xml(code)
<?xml version=”1.0″ encoding=”utf-8″ ?>
<Elements xmlns=”http://schemas.microsoft.com/sharepoint/”>  
<!– Custom Action in Site Actions Menu –>
<CustomAction
        Id=”MyNewCustomAction”
        Description=”This menu item is a new custom action.”
        Title=”My New Custom Action”
        GroupId=”SiteActions”
        Location=”Microsoft.SharePoint.StandardMenu”
        ImageUrl=”/_layouts/user.aspx”
        Sequence=”10″>
<UrlAction Url=”http://myserver:1985/new/MyCustomPage2.aspx />
</CustomAction>
<!– Hide Custom Action –>
<HideCustomAction
        Id=”HideDeleteWeb”
        GroupId=”SiteAdministration”
        Location=”Microsoft.SharePoint.SiteSettings”
        HideActionId=”DeleteWeb” />
</Elements>
Open cmd:
cd
F:Program FilesCommon FilesMicrosoft Sharedwebserver extensions12BIN then
press enter.
Write below command on command prompt:
stsadm
-o installfeature -filename myfolderfeature.xml (and press enter)
now you will see a message “Operation completed Successfully”
After that open your application in Central Administrator.
Site Actions->Create
Web Pages->Basic Page
Give a name to the page.
Here I have used “MyCustomPage2.aspx “.
Go to Site Actions->Site Settings
Under Site Administrator section click on site features
You will find the list of site features.
Select your feature.
In
this case I have used the name “My Custom Action Feature” (See
this name in feature.xml).
click
on Activate.

Leave a Comment

RSS
YouTube
YouTube
Instagram