tasks get assigned to the System Account after delegation

Mar 12, 2013 at 6:41 AM
for all the users' the tasks get assigned to the system account after the do the delegation. i've checked the permission and it's fine

what's the cause?
Mar 12, 2013 at 8:52 AM
Edited Mar 12, 2013 at 8:54 AM
Ok i have solved the issue... i downloaded the source code and found an exception in this line:
SPUser task_owner = properties.Web.EnsureUser(item["task_owner"].ToString());
the exception says that the user couldn't be found because the string item["task_owner"].ToString() got returned with some characters before the user name.

So i replace this line with this:
string user = item["task_owner"].ToString();
SPFieldLookupValue Userlookup = new SPFieldLookupValue(user);
SPUser task_owner = properties.Web.EnsureUser(Userlookup.LookupValue);
to clear up the returned string before ensure user search for the SPUser

Thank you very much