How to create site column of Hyperlink with formatting and constraints for publishing programmatically?
1 Answer
You can try below
SPList _list = web.Lists["ListName"];
Microsoft.SharePoint.Publishing.Fields.LinkField linkfds = _list.Fields.CreateNewField("Link", "Test") as Microsoft.SharePoint.Publishing.Fields.LinkField;
_list.Fields.Add(linkfds);
_list.Update();
Note - you should add reference to Microsoft.SharePoint.Publishing.dll