📜 ⬆️ ⬇️

Create a feature to change the design

Today, we will consider one of the ways to change the design of the Sharepoint portal - creating features.

Features are not only thoroughly documented bugs, but also a mechanism for adding new functionality, web parts, pages, design elements to a site or a collection of Sharepoint sites.

In order to create a feature, you need to create several files in xml format. The main one is feature.xml.
')
More details on how to create features and what they can do can be found on the Microsoft MSDN website at msdn.microsoft.com/en-us/library/ms475286.aspx



Creating a feature


You can find various recommendations for developing SharePoint Features from Visual Studio. I prefer to use Visual Studio 2008 to create a project using the Class Library template. Many will probably like VSeWSS, an extension for Visual Studio that allows you to create almost ready-made projects for Sharepoint.

image

As a result, we need to create a project with the structure as in the picture on the left.

That is, we should have a sss file, pictures and an asp.net master page.

The main file needed for Feature is the feature.xml file.

Each Feature has an identifier, title, description, and scope (site, site collection, and farm).

image
This feature has another xml file CopyFiles.xml in which the copying of pictures, css and master page from the disk on the server to the portal, that is, to the portal database takes place.

image

Installation


The created Feature is copied to the C: \ Program Files \ Common Files \ Microsoft Shared \ web server extensions \ 12 \ TEMPLATE \ FEATURES folder. There you can also view and explore the standard features in Sharepoint.

Next, run the command line: stsadm -o installfeature -name ExCustomDesign

Then go to the features activation page and activate it.

image
Next you need to apply the installed master page.

image

We get rid of handmade



And now, let's get rid of the last step, that is, choosing the master page manually. To do this, write a simple FeatureReceiver:

image

And add the Receiver description to Feature.xml:

image

After activating the feature, we got the following result.

image

That's all for today. We will talk about the creation of installation packages and website templates in the following articles.

Successful site building!

Source: https://habr.com/ru/post/54111/


All Articles