What is SharePoint Site Columns:
Basically, in SharePoint, you add a column in list and library directly.Site columns are some standard column, you can add in SharePoint site and Sub site list and libraries.Site columns are very useful and reusable column, save your much time.SharePoint site column are like a template can be use over site and sub site but not in parrlal site collection.You don’t need to create custom column within each individual List or Library if, you have created site column.
How to create SharePoint site columns:
to create site column is very simple and and straightforward.Let’s see below step to creation of site column.
- Select the ‘cog’ on the top right corner and click on ‘Site settings’ option:
- Click on Site Column in the section of Web Designer Galleries
- Click on Create button to creating new site column
- Now fill all the required information
- 5. In the Existing group, drop-down either create your own specific named group or select custom group. click on create. Now site column will be added to the custom group.
Add site column to list and libraries:
- Go to list on which you want to add site column
- Go to List setting and Scroll down and select ‘add from existing site columns’
- Now add site column from custom column group in which you have added it.
- Finally, your site column has been added.
You can add same column in any another site and sub site document library and list by using the same process.It will store data in respective a document library and list.
Create Site Column Programmatically using CSOM
If you want to create site column CSOM programmatically, you can create site column with the different data type as Text field, Indexed field, Multi-line field, Boolean field, Date Time field, Number field, Choice field etc. Below is code link for creating site column with different data type. There are some attributes specified that will be used in creating fields.
- The ID of the field, which is a GUID- Not mandatory it will auto generate
- The Name, which is the internal name of the field
- The StaticName, which is the static name of the field
- The DisplayName, which is display name of the field
- The Type attribute which indicates the data type of the field