This SharePoint tutorial explains, what is site column in SharePoint? How to create a site column in SharePoint Online or SharePoint 2013/2016? We will also discuss how to modify a site column in SharePoint? Let us discuss on SharePoint site columns and how to create a site column using Rest API in SharePoint Online or SharePoint 2013, SharePoint 2016, or SharePoint 2019.
Let us learn:
- How to add a site column to list or library in SharePoint Online
- sharepoint site columns vs list columns
- sharepoint site columns best practices
- create site column in sharepoint online using PowerShell
- How to add site column to SharePoint list programmatically using csom
How to create a SharePoint site column? To create a site column in SharePoint, Open the SharePoint Online site, Go to the Site settings page, then under Web Designer Galleries click on Site columns. Then click on Create, then provide the column name, choose the data type, and select the Group. Then click on Create.
Let us check out in details.
What are SharePont site columns
What is s SharePoint site column? A SharePoint site column is a reusable column that we can use in any list and library in the site and any nested subsite under the SharePoint site. By creating a site column at the site level we can use that in any lists and libraries of the current site and child sites in SharePoint.
For example suppose we create a list which contains “department name” column and we want to add the “department name” column in another list, which cannot be possible. So instead of creating the column in the list level, we have to create the column in the site level as a site column.
Create a Site Column in SharePoint
Follow the below steps to create a site column in SharePoint 2016/2013 or SharePoint Online.
Step-1: Open SharePoint site, from gear icon click on “Site settings”.

Step-2: In Site Settings page click on “Site columns“.

Step-3: In the site columns page click on “Create“.

Step-4: In create column page we have to give a column name here I am giving “Department Name” as column name. From the “type of information in this column is” we can choose any options but I have chosen the “choice”.

Step-5: In the group, we can choose the existing group or new group but here I have been chosen “New group” and give the name as “Department Group” and the description field is there which is nothing but the description of our site column.
One more option we can see “Type each choice on a separate line”, here we can add the items. I am giving “HR, Finance, IT, Accountant “items in that field.

Step-6: We can see “Display choice using” field we can choose anyone. I have chosen the dropdown so in list we can see out items in dropdown. In “Allow ‘Fill-in’ choices” field we can see “NO” option is selected which is by default.
Below that field “Default Value” field is there here I am selecting the choice option and type HR. So when we open the column in list we can see “HR” item in the above. Then click on “OK”.

Step-7: We can see out site column group in “All group”.

Add SharePoint Site Column to List or Document Library
We have created the site column, now we will see how we can add the site column to a SharePoint 2016/2013 or SharePoint Online list.
Step-1: Here I am creating the custom list named “Employee List”. In Employee, list page, go to “list” which is present in the ribbon. Click on list settings in the list option to open the list settings page.
Step-2: In list setting page, go to the columns section and you can find “Add from existing site columns”, click on that.

Step-3: Now we can find the page like below. Here in “Select the site column from” field we have to chose our site column group then click on “Add”.

Step-4: Here we can see our site column is added then click on ok.

Step-5: In the Employee list page we can found our site column (the highlighted one).

Step-6: When we click on a new item we can see the page like below. In “Employee Name” field I am giving the name and in department name we can see the dropdown. Click on Save.

Step-7: In Employee list we can see our department name and Employee name.

Edit a site column in SharePoint
The following steps can be followed to modify the site columns
Step-1: Go to site column page, click on “All group”. We can see our “Department Group” which will show all the site column.

Step-2: We have click on the column name which we want to edit. Now we can see edit column page where we can edit. I am adding a new “Department name” as “Management” in my site column like below then click on “OK”.

Step-3: When we open the list page and click on “Add new items” we can found the following dropdown, click on “Save”.

Step-4: Now we can see our list page like below.

Create SharePoint site column programmatically using Rest API
Now, let us see how to create a SharePoint site column programmatically using SharePoint Rest API. The same Rest API code you can use to create SharePoint 2013 site columns.
Here, we will provide a user the option to enter the site column name and there will be a button, on click of the button, the SharePoint site column will get created.
The below code you can add inside a SharePoint script editor web part or content editor web part.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
$(function(){
$("#btnClick").click(function(){
var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/fields";
var siteColumnname = $("#txtSiteColumnName").val();
$.ajax({
url: requestUri,
type: "POST",
data: JSON.stringify(
{ '__metadata': { 'type': 'SP.Field' },
'Title': siteColumnname,
'FieldTypeKind': 2,
'Group': 'SPGuides Site Columns'
}),
headers: {
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: onSuccess,
error: onError
});
function onSuccess(data) {
alert('Site column created successfully');
}
function onError(error) {
alert(JSON.stringify(error));
}
});
});
</script>
<table>
<tr>
<td>
Enter Site Column Name: <input type="text" id="txtSiteColumnName">
</td>
<td>
<input type="button" id="btnClick" value="Create Site column using REST API"/>
</td>
</tr>
</table>
Once you Save the code, the HTML form will look like below:

Once you provide the SharePoint site column name and click on the button, the SharePoint site column will be created.
This is how we can create site columns programmatically using Rest API in SharePoint. The rest api code, you can use to create SharePoint 2013 site columns programmatically using Rest API.
SharePoint site column vs list column
Should I create site columns or list columns in SharePoint? Trying to find out the difference between SharePoint site column and list column? Read to know more on the SharePoint site column vs list column.
There are two types of columns we can create in SharePoint to store metadata or information.
- List columns
- Site columns
If you are directly creating columns in a SharePoint list, those are known as the list columns and those are available only in that specific list. You can not reuse list columns in any other list or site.
On the other hand, we can reuse the SharePoint site columns in a site and the sites and nest subsites. So basically site columns are reusable in parent sites as well as all the subsites.
You can check blow where the SharePoint site columns will be available.

Apart from that, when you create a site column, SharePoint automatically index those columns behind the scene.
SharePoint site columns best practices
Now, let us see some of the best practices you should follow while creating site columns in SharePoint.
- Like columns, always provide short, meaningful names for your site column. Do not provide space or special characters for your SharePoint column name. If you will provide space, the site column will render as %20 for space. Like the First Name will appear like First%20Name as the internal name.
- When you are created site columns provide the internal names properly, maybe append with your company name or project name. Like TSInfoFirstName, TSInfoLastName will be the internal names and the display names will be First Name and Last Name. There are lots of predefined site columns are available in SharePoint and if you will try to create a custom site column with the same name, it will not allow. For example, instead of the Department, you can provide the internal name as TSInfoDepartment.
- For all your SharePoint custom site columns, create a group to categories all your site columns. You can use your company name or project name as the group like TSInfo Site Columns.
- If you want to create more site columns, then do not create manually, always you can create a CSV or excel file to keep the information like column display name, internal names, default values, etc. And then you can write a piece of code to create the SharePoint site columns programmatically using PowerShell, Rest API, CSOM, etc.
Create site column in SharePoint Online using PowerShell
Now, let us see how to create a site column in SharePoint Online using PowerShell.
Below is the PowerShell script you can use to create SharePoint site column using PowerShell.
You can run the below PowerShell script using Windows PowerShell ISE.
Single Line of Text:
Below is the PowerShell script to create a SharePoint site column of type Single line text. Here, we need to add Type=’Text’ for the Field.
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
$siteUrl = "https://tsinfo.sharepoint.com/sites/TSInfoClassic/"
$siteColumnGroupname='SPGuides Site Columns'
$internalName='SPGuidesYourFirstName'
$displayName='Your First Name'
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$credentials= Get-Credential
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($credentials.Username, $credentials.Password)
$allColumns = $ctx.web.Fields
$ctx.Load($allColumns)
$ctx.executeQuery()
$newColumn = $allColumns | where {$_.Title -eq $displayName}
if($newColumn -ne $NULL)
{
Write-host "SharePoint Site Column already exists!"
}
else
{
$FieldSchema = "<Field Type='Text' DisplayName='$displayName' Name='$internalName' required='False' Group='$siteColumnGroupname'/>"
$newColumn = $allColumns.AddFieldAsXml($FieldSchema,$True,[Microsoft.SharePoint.Client.AddFieldOptions]::AddFieldToDefaultView)
$ctx.ExecuteQuery()
Write-host "SharePoint Site Column Created Successfully!"
}
Once you run the above PowerShell script, the SharePoint site column will be created successfully like below:

This is how we can create site column in SharePoint online using PowerShell.
Multiple lines of text:
Below is the PowerShell script to create multiple lines of text SharePoint site column. In the Type, set as Note in the Field like Type=’Note’.
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
$siteUrl = "https://tsinfo.sharepoint.com/sites/TSInfoClassic/"
$siteColumnGroupname='SPGuides Site Columns'
$internalName='SPGuidesYourAddress'
$displayName='Your Address'
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$credentials= Get-Credential
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($credentials.Username, $credentials.Password)
$allColumns = $ctx.web.Fields
$ctx.Load($allColumns)
$ctx.executeQuery()
$newColumn = $allColumns | where {$_.Title -eq $displayName}
if($newColumn -ne $NULL)
{
Write-host "SharePoint Site Column already exists!"
}
else
{
$FieldSchema = "<Field Type='Note' DisplayName='$displayName' Name='$internalName' required='False' Group='$siteColumnGroupname'/>"
$newColumn = $allColumns.AddFieldAsXml($FieldSchema,$True,[Microsoft.SharePoint.Client.AddFieldOptions]::AddFieldToDefaultView)
$ctx.ExecuteQuery()
Write-host "SharePoint Site Column Created Successfully!"
}
This is how we can create a multiline text column in SharePoint Online using PowerShell.
Date and Time:
Below is the PowerShell script to create site column of type Date and Time. You can add additional parameters like Format=’DateOnly’.
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
$siteUrl = "https://tsinfo.sharepoint.com/sites/TSInfoClassic/"
$siteColumnGroupname='SPGuides Site Columns'
$internalName='SPGuidesJoininDate'
$displayName='Your Joining Date'
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$credentials= Get-Credential
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($credentials.Username, $credentials.Password)
$allColumns = $ctx.web.Fields
$ctx.Load($allColumns)
$ctx.executeQuery()
$newColumn = $allColumns | where {$_.Title -eq $displayName}
if($newColumn -ne $NULL)
{
Write-host "SharePoint Site Column already exists!"
}
else
{
$FieldSchema = "<Field Type='DateTime' DisplayName='$displayName' Name='$internalName' Format='DateOnly' required='False' Group='$siteColumnGroupname'/>"
$newColumn = $allColumns.AddFieldAsXml($FieldSchema,$True,[Microsoft.SharePoint.Client.AddFieldOptions]::AddFieldToDefaultView)
$ctx.ExecuteQuery()
Write-host "SharePoint Site Column Created Successfully!"
}
Once you run the PowerShell script, it will create a Date and Time type SharePoint site column.
Person or Group:
We can also create a person or group type SharePoint site column using PowerShell in SharePoint Online.
Here the field Type will be User, a few other parameters are like Type=’User’ ShowField=’ImnName’ List=’UserInfo’ UserSelectionMode=’PeopleOnly’ etc.
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
$siteUrl = "https://tsinfo.sharepoint.com/sites/TSInfoClassic/"
$siteColumnGroupname='SPGuides Site Columns'
$internalName='SPGuidesManagerName'
$displayName='Your Manager Name'
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$credentials= Get-Credential
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($credentials.Username, $credentials.Password)
$allColumns = $ctx.web.Fields
$ctx.Load($allColumns)
$ctx.executeQuery()
$newColumn = $allColumns | where {$_.Title -eq $displayName}
if($newColumn -ne $NULL)
{
Write-host "SharePoint Site Column already exists!"
}
else
{
$FieldSchema = "<Field Type='User' DisplayName='$displayName' Name='$internalName' ShowField='ImnName' List='UserInfo' UserSelectionMode='PeopleOnly' required='False' Group='$siteColumnGroupname'/>"
$newColumn = $allColumns.AddFieldAsXml($FieldSchema,$True,[Microsoft.SharePoint.Client.AddFieldOptions]::AddFieldToDefaultView)
$ctx.ExecuteQuery()
Write-host "SharePoint Site Column Created Successfully!"
}
This is how we can create a person or group (people picker) column in SharePoint using PowerShell.
Choice Type Column:
Now, let us check how to create choice type site column in SharePoint using PowerShell. Here we need to define Type=’Choice’ and then we need to provide the choice options like:
<CHOICES><CHOICE>HR</CHOICE><CHOICE>Finance</CHOICE><CHOICE>IT</CHOICE></CHOICES>
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
$siteUrl = "https://tsinfo.sharepoint.com/sites/TSInfoClassic/"
$siteColumnGroupname='SPGuides Site Columns'
$internalName='SPGuidesDepartment'
$displayName='Your Department'
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$credentials= Get-Credential
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($credentials.Username, $credentials.Password)
$allColumns = $ctx.web.Fields
$ctx.Load($allColumns)
$ctx.executeQuery()
$newColumn = $allColumns | where {$_.Title -eq $displayName}
if($newColumn -ne $NULL)
{
Write-host "SharePoint Site Column already exists!"
}
else
{
$FieldSchema = "<Field Type='Choice' DisplayName='$displayName' Name='$internalName' required='False' Group='$siteColumnGroupname'><CHOICES><CHOICE>HR</CHOICE><CHOICE>Finance</CHOICE><CHOICE>IT</CHOICE></CHOICES></Field>"
$newColumn = $allColumns.AddFieldAsXml($FieldSchema,$True,[Microsoft.SharePoint.Client.AddFieldOptions]::AddFieldToDefaultView)
$ctx.ExecuteQuery()
Write-host "SharePoint Site Column Created Successfully!"
}
This is how we can create a choice type column in SharePoint Online using PowerShell.
Add site column to SharePoint list programmatically using csom
Here we will check how we can add site columns to existing SharePoint online lists or document libraries using csom (.Net managed object model code). Recently I got one requirement to add one site column to a few lists and document libraries using C#.Net (Microsoft.SharePoint.Client.dll) code.
Here I have written the below method which will take a single parameter as URL (need to provide the site URL).
You can run the code from a console application using visual studio 2015.
In the below example I will add one site column name as “MySiteColumnName” to different 3 SharePoint online list.
private static IList<string> listNames = new List<string>();
public static void AddSiteColumnToExistingList(string URL)
{
listNames.Add("List1");
listNames.Add("List2");
listNames.Add("List3");
using (ClientContext ctx = new ClientContext(URL))
{
ctx.AuthenticationMode = ClientAuthenticationMode.Default;
ctx.Credentials = new SharePointOnlineCredentials(GetSPOAccountName(), GetSPOSecureStringPassword());
foreach (string targetListName in listNames)
{
List targetList = ctx.Web.Lists.GetByTitle(targetListName);
ctx.Load(targetList);
ctx.ExecuteQuery();
string siteCols = "MySiteColumnName";
FieldCollection fieldCollection = ctx.Web.AvailableFields;
ctx.Load(fieldCollection);
ctx.ExecuteQuery();
Field myField = Enumerable.FirstOrDefault(fieldCollection, ft => ft.InternalName == siteCols);
targetList.Fields.Add(myField);
targetList.Update();
ctx.ExecuteQuery();
}
}
}
private static string GetSPOAccountName()
{
try
{
return ConfigurationManager.AppSettings["SPOAccount"];
}
catch
{
throw;
}
}
private static SecureString GetSPOSecureStringPassword()
{
try
{
var secureString = new SecureString();
foreach (char c in ConfigurationManager.AppSettings["SPOPassword"])
{
secureString.AppendChar(c);
}
return secureString;
}
catch
{
throw;
}
}
Once you will run the code, it will add the “MySiteColumnName” site column to all the 3 lists. I hope this will be helpful to add site column to list programmatically in SharePoint Online.
Create SharePoint Choice Column using SharePoint hosted Apps or Add-ins
Now, let us see how to create SharePoint choice column using SharePoint hosted apps or add-ins.
To start this, we need to create a SharePoint hosted app, Please follow the article on SharePoint hosted app – Detailed Tutorial + Example before proceeding.
Now follow the below steps to add a site column of type choice programmatically in SharePoint.
Right click on Visual Studio 2017/2015 -> Add -> New Item…
Then in the Add New Item dialog box, choose Site Column and give a name and then click on Add.
By default SharePoint will add Text type column.
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Field
ID="{d8102081-02cf-48df-a41f-a4c9b914b313}"
Name="TrainingCourses"
DisplayName="Training Courses"
Type="Text"
Required="FALSE"
Group="Custom Site Columns">
</Field>
</Elements>
To add choice column, we can change the Type to Choice and then we can add the choices inside <CHOICES> </CHOICES>.
Similarly to add mapping values, we can inside Mapping attribute and to add a default value, we can add inside <Default></Default> attribute.
The full code looks like below:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Field
ID="{d8102081-02cf-48df-a41f-a4c9b914b313}"
Name="TrainingCourses"
DisplayName="Training Courses"
Type="Choice"
Required="FALSE"
Group="Custom Site Columns">
<CHOICES>
<CHOICE>SharePoint 2016</CHOICE>
<CHOICE>SharePoint 2013</CHOICE>
<CHOICE>SharePoint 2010</CHOICE>
<CHOICE>SharePoint Online</CHOICE>
<CHOICE>Office 365</CHOICE>
<CHOICE>Microsoft Azure</CHOICE>
</CHOICES>
<MAPPINGS>
<MAPPING Value="1">SharePoint 2016</MAPPING>
<MAPPING Value="2">SharePoint 2013</MAPPING>
<MAPPING Value="3">SharePoint 2010</MAPPING>
<MAPPING Value="4">SharePoint Online</MAPPING>
<MAPPING Value="5">Office 365</MAPPING>
<MAPPING Value="6">Microsoft Azure</MAPPING>
</MAPPINGS>
<Default>SharePoint Online</Default>
</Field>
</Elements>
This is how to create a choice type site column programmatically using jsom in SharePoint hosted add-in.
Read SharePoint tutorials:
- How to Create Site Columns, Content Type and Custom List using SharePoint Framework
- Create Site Columns programmatically in SharePoint 2016/2013 using Server Object Model in Visual Studio 2017
- Lookup column in SharePoint Online/2013/2016 (with example on lookup site column)
- PnP PowerShell commands for SharePoint Online Site
- Create Custom Field/Column in SharePoint Online List using PnP
Conclusion:
In this SharePoint tutorial, we learned about the SharePoint site column, how to create a site column in SharePoint? And how to create SharePoint site column programmatically using Rest API. Finally, we learned how to add SharePoint site column to an existing SharePoint list or document library. Site columns work same way in SharePoint Online and SharePoint 2013, SharePoint 2016, and SharePoint 2019.
Also, we learned sharepoint site columns vs list columns, sharepoint site columns best practices, and how to create site columns in sharepoint online using Powershell. Also, we saw, How to add a site column to the SharePoint list programmatically using csom.
Hello Everyone!! I am Bhawana a SharePoint MVP and having about 10+ years of SharePoint experience as well as in .Net technologies. I have worked in all the versions of SharePoint from wss to Office 365. I have good exposure in Customization and Migration using Nintex, Metalogix tools. Now exploring more in SharePoint 2016 🙂 Hope here I can contribute and share my knowledge to the fullest. As I believe “There is no wealth like knowledge and no poverty like ignorance”