I have scenario that if i update any item in a listA(in sitecollection1) it should update in another listB(sitecollection2)..
I am using beforeproperties it is throwing null value..
but i need that previous value of listA which i have updated just now in "itemupdated" event receiver
here is my code
public override void ItemUpdated(SPItemEventProperties properties){
base.ItemUpdated(properties);
using (SPWeb web = new SPSite("http://natex2:1990/sites/ess/facilities/spaces").OpenWeb())
{
web.AllowUnsafeUpdates = true;
SPList list = web.Lists.TryGetList("LocationDetails");
//string querry = properties.ListItem["Title"].ToString();
string querry = properties.BeforeProperties["Title"].ToString();
SPQuery qury = new SPQuery();
qury.Query = "<Where><Eq>" +
"<FieldRef Name='Title' />" +
"<Value Type='Text'>" + querry + "</Value>" +
"</Eq>" +
"</Where>";
SPListItemCollection coll = list.GetItems(qury);
foreach (SPListItem item in coll)
{
string data = properties.AfterProperties["Title"].ToString();
item["Title"] = data;
list.Update();
}
web.AllowUnsafeUpdates = false;
}
}
please anybody help me i need urgent help