I wonder how should I make a large update in Event Receiver by executing it in other thread. Normally it would look like that:
public override void ItemUpdating(SPItemEventProperties properties)
{
base.ItemUpdating(properties);
SPList myList = properties.Web.Lists["myList"];
SPQuery spQuery = new SPQuery();
spQuery.Query = "<Where><Eq><FieldRef Name='MyField' LookupId='true' /><Value Type='Lookup'>" + properties.ListItemId + "</Value></Eq></Where>";
SPListItemCollection itemCollection = myList.GetItems(spQuery);
foreach(SPListItem item in itemCollection)
{
...
}
}
But that "trigger" can affect event 100 000 rows in myList. So what is the best practice to do it, but programmatically, not using Workflows.
I mean something like:
public override void ItemUpdating(SPItemEventProperties properties)
{
base.ItemUpdating(properties);
// other "thread"
UpdateMyList(properties.ListItemId);
}
It would also be nice to know when the taks is completed and give a user a feedback, when he works with the site, changing pages etc
Is that possible at all?