Sunday, December 29, 2013

Get original URL for Link to a Document content type

Given you are capturing ItemAdded in document library most likely youare AfterProperties will always be null. Read the following blog post. Though its written for MOSS 2007 I am assuming this will stay the same for SP2010.


http://www.synergyonline.com/Blog/Lists/Posts/Post.aspx?ID=122


Instead use this code and see if it works



SPListItem item = Properties.ListItem;

SPFieldUrlValue itmURL = new SPFieldUrlValue();

if(!String.IsNullOrEmpty(item["URL"]))
{
itmURL = item["URL"];
String URLDesc = itmURL.Description;
String URL = itmURL.Url ;
}






Amit


No comments:

Post a Comment