Create URL Type Site Column using CSOM

Create URL Type Site Column using CSOM programmatically in SharePoint

In this post, I describe you to Create URL Type Site Column using CSOM.If you need to create a column that contains a hyperlink, you also have to define a column type URL, but in this case, you need to set the Format attribute Hyperlink. If you need to create choice type site column follow my post-Create. Choice Type Site Column using CSOM

[AdSense-A]

 ClientContext clientContext = new ClientContext(SiteUrls);
                Web rootWeb = clientContext.Site.RootWeb;
                string schemaUrlField = "<Field ID='<GUID>' Type='URL' Name='BlogUrl' StaticName='BlogUrl' DisplayName='Blog URL' Format='Hyperlink'/>";";
                rootWeb.Fields.AddFieldAsXml(schemaNumberColumn, true, AddFieldOptions.AddFieldInternalNameHint);
                clientContext.ExecuteQuery();

 


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 !!