I have created an Event Receiver, which is a An item was added
type; In my list I have a column called Fotografia
it is a Publishing Image
type;
In my site-assets library I have an Image called DefImg
image could be founded in this: ~/SiteAssets/DefImg.png
In my Event Reciever I have the following code:
public override void ItemAdded(SPItemEventProperties properties)
{
base.ItemAdded(properties);
base.ItemAdded(properties);
using (SPWeb web = properties.OpenWeb())
{
try
{
SPListItem currentItem = properties.ListItem;
if (currentItem["Fotografia"] == null)
{
currentItem["Fotografia"] = "~/SiteAssets/DefImg.png";
}
currentItem.Update();
}
catch (Exception ex)
{
throw ex;
}
}
}
How Can I set currentItem["Fotografia"]
to the image that could be found in Site Assets Library?