This code snippet could help you easily gets the User from Person/Group field in SharePoint list.
SPFieldUserValue userField = (SPFieldUserValue)list.Fields["Assigned To"].GetFieldValue(item["Assigned To"].ToString());
SPUser user= userField.User;
If your requirements would be higher, have a look here:
http://david-rehak-sharepoint.blogspot.com/2011/11/how-to-get-spuser-or-spgroup-from.html
Happy coding ;)
No comments:
Post a Comment