(BTW, you can use the SPFieldUrlValue class to extract the URL and description).
Anyhow, I wanted to generate a relative path from stored absolute value. I used the following code to do it.
Maybe you know a better way.....?
SPFieldUrlValue spFieldUrlValue = new SPFieldUrlValue(fieldValue);
string targetUrl = spFieldUrlValue.Url;
using(SPSite site = new SPSite(targetUrl))
{
return targetUrl.Replace(site.Url, String.Empty);
}
No comments:
Post a Comment