How to Create Site Columns in SharePoint Hosted Apps
To create a custom list by content types or even to create custom content type first you have to add site columns for those columns which you want to add in list or content type.
It is very easy and short process to create site columns, let’s have a look
a) Right click project name -> Add -> New Item.
b) Select ‘Site Column’ template which belongs in ‘Office/SharePoint’ category, set name for the column and click the ‘Add’ button.
2) It will add Site Column in project, open Elements.xml file of the recently added column.
3) You can set Data Type of column and other attributes in Elements.xml file.
<?xml version=”1.0″ encoding=”utf-8″?>
<Elements xmlns=”http://schemas.microsoft.com/sharepoint/”>
<Field
ID=”{a52d410c-bdd2-4b58-95f0-11a7239c0cc3}”
Name=”Holidays” => this Name is used by environment so can’t put any space between the name otherwise apps will not publish
DisplayName=”Holidays” =>This field value will display on UI so here you can keep space between name
Type=”Text” => set datatype of column
Required=”TRUE” => set either column value should be mandatory or not
Group=”Custom Site Columns”>
<Default></Default> => here you can set default value for column
<Formula>[mention formula here]</Formula>
</Field>
</Elements>
Refer below link for attributes & Data type of columns.
http://msdn.microsoft.com/en-us/library/aa979575(v=office.14).aspx