Steps Involved:
- Open Visual Studio 2010 by going Start | All Programs | Microsoft Visual Studio 2010 | Right click on Microsoft Visual Studio 2010 and click on Run as administrator.
- Go to File tab, click on New and then click on Project.
- In the New Project dialog box, expand the Visual C# node, and then select the SharePoint 2010 node.
- In the Templates pane, select Empty SharePoint Project.
- Enter the Name as CalculatedColumn and then click OK.
- In the solution explorer, right click on the solution and then click on Add -> New Item.
- Select the Empty Element from the templates.
- Enter the Name as CalculatedColumn and then click on Ok.
- Open Elements.xml and replace with the following code.
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Field ID="{07C57649-CBA9-4FF7-A892-9E9A3705541C}" Name="CalculatedField" DisplayName="Calculated Field" Type="Calculated" ResultType="Text" Description="Calculated Field Example" Group="Vijai Site Columns" > <Formula>=[Title]</Formula> </Field> </Elements>
|
Deploy and Test:
Deploy the solution. Go to the SharePoint site, Site Actions -> Site Settings -> Galleries -> Site Columns -> Vijai Site Columns group. You could be able to see the new created calculated column.