Create Boolean Type Site Column using CSOM

Create Boolean Type Site Column using CSOM in SharePoint Programmatically

In this post i describe you to Create Boolean Type Site Column using CSOM. You can create Boolean Type Field manually. But if you need to create column in bulk then we have to write code for this. If you need to create Text Type Site Column using csom then follow my post.Create Text Type Site Column using CSOM . For Multi Line Text Column Create multi line Site Column using CSOM


                ClientContext clientContext = new ClientContext(SiteUrls);
                Web rootWeb = clientContext.Site.RootWeb;
                string schemaMultilineTextField = "<Field  Type='Boolean' Name='" + InternalName + "' StaticName='" + Displayname + "' DisplayName='" + Displayname + "' Group='" + groupName + "'  />";
                Field multilineTextField = rootWeb.Fields.AddFieldAsXml(schemaMultilineTextField, true, AddFieldOptions.AddFieldInternalNameHint);
            catch (Exception ex)

If you want to set a default value, you have to specify a 0 for false or a 1 for true:

string schemaBooleanField = "<Field Type='Boolean' Name='Married' StaticName='Married' DisplayName='Married'>"
    + "<Default>0</Default></Field>;


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

error: Content is protected !!