Updating hyperlink fields programmatically

Data in the Hyperlink Column can be populated / set in the following manners: 
Item[“HyperLinkColumnName”] = “http://www.google.com, Google”;
Don’t forget space after comma. 
SPFieldUrlValue MyURL = new SPFieldUrlValue();
MyURL.Description = “Google”;
MyURL.Url = http://www.google.com;
Item[“HyperLinkColumnName”] = MyURL;  

Data from the Hyperlink Column can be get in the following manner: 
SPFieldUrlValue MyURL = new SPFieldUrlValue(Item[“HyperLinkColumnName”].ToString()); 
string URLText = MyURL.Description;
string URL = MyURL.Url; 


Popular posts from this blog

Using External Content Types with Stored Procedures with Input Parameters

HTTPS Site InfoPath Issue : You do not have permissions to access a web service that provides data required for this form to function correctly

Windows 7 Blue Screen because of ConnectiFy