Problems doing the simplest things. I want to update a task created by the CreateTask activity, when the activity is changed. I have the following function, which is run when the Task list item is edited…
private void onTaskChanged1_Invoked(object sender, ExternalDataEventArgs e)
{
SPWeb mySite = new SPSite(workflowProperties.SiteId).OpenWeb(workflowProperties.WebId);
SPList myList = mySite.Lists[workflowProperties.TaskListId];
SPListItem myTask = myList.GetItemById(TaskBeforeProperties.TaskItemId);
SPUser myUser = mySite.AllUsers[e.Identity];
myTask["Assigned To"] = myUser;
myTask.Update();
}
Everything seems okay, but when I call myTask.Update(), I get the exception “An event receiver has cancelled the request.” And I’m damned if I know why.
Hi Andrew,
I have been going through your articles on sharepoint for quite a while now. I should admit, they really are informative and educative as well.
Anyways, just thought of sharing an idea on UpdateTask activity that you have mentioned above. I also faced a similar issue until I defined a New TaskProperties (eg: updatetask_taskproperties) with the TaskID and correlation tokens to the parent CreateTask Activity. Using this workaround, it started working like a charm.
Hope that helps,
Regards,
Anand