SharePoint URL retrieval for SPListItem


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:,%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