Sunday, December 29, 2013

Get original URL for Link to a Document content type

Hello,


I'm having a SharePoint doc library with ItemAdded event receiver attached to it and "Link to a Document" content type enabled. My general question is:


How to get URL that the link points to?


I'll show you how I'm trying to achieve that:



SPWeb parentWeb = properties.Web;
if (properties.ListItem.ContentType.Name == LinkContentTypeName)
{
object urlFieldValue = properties.AfterProperties["URL"];
if (urlFieldValue != null && urlFieldValue.ToString() != String.Empty)
{
// continue
}
}

But I always get null so I can't even get inside IF statement. I've tried to install ItemAdded event receiver as synchronous, but it didn't make a difference. I'd appreciate any ideas.


Regards


Tomasz


No comments:

Post a Comment