Create Site Column using CSOM

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:

[AdSense-A]

  • Click on Site Column in the section of Web Designer Galleries

[AdSense-A]

  •  Click on Create button to creating new site column

[AdSense-A]

 

  •  Now fill all the required information

[AdSense-A]

 

  • 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.

[AdSense-A]

 

 

Add site column to list and libraries:

  • Go to list on which you want to add site column

[AdSense-A]

 

  •  Go to List setting and Scroll down and select ‘add from existing site columns’

[AdSense-A]

 

 

  • Now add site column from custom column group in which you have added it.

[AdSense-A]

 

  • Finally, your site column has been added.

[AdSense-A]

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
  • [AdSense-A]

Create a Text field using CSOM

Create a multi-line field using CSOM

Create Boolean Type Site Column using CSOM

Create DateTime Type Site Column using CSOM

Create Number Type Site Column using CSOM

Create Choice Type Site Column using CSOM

Create Picture Type Site Column using CSOM

Create URL Type Site Column using CSOM

Create Lookup Type Site Column using CSOM

Create Managed Metadata Site Column using CSOM