I have a task List and with an Event receiver , I am trying to get all the users that this task is assigned to. but when getting the item as "SPListItem" , the field assigned to is getting a sting and not a User , and this string is the First name of the User in the active Directory that isn't enough to get the user knowing that Name isn't Primary Key. what is the way to get the assigned users or group.
Use can make use of SPUser to get the User object, from that object you can get all the informations about the user from Active Directory.
SPUser user = web.EnsureUser("FirstnameWhichyougotfromSPListItem") ;
Now make use of "user" to get the ID, name, email ID, etc.
SPFieldUserValue value = new SPFieldUserValue(web, task["Assigned To"].ToString());
Now make use of value, to get the LoginName, lookupID, etc of the user.
hope this helps you.