SharePoint URL retrieval for SPListItem

listsharepoint

When I try to retrieve a column which is a hyperlink I get two items that are comma delimited instead of one.

When I pull item["ColumnName"] I get its value:

http://www.google.com/article/583,%20title%20gets%20stars

Why is it showing the link, and title?

Best Answer

You can extract the actual Url and the Description from the column value this way:

SPFieldUrlValue fieldValue = new SPFieldUrlValue(myItem["URL"].ToString());

string linkTitle = fieldValue.Description;

string linkUrl = fieldValue.Url;
Related Topic