Trying to get the e-mail adress of a user for whom you only have the display name like surname and name, you can get the user information by using the SPUtility function ResolvePrincipal. It’s quite easy but you have to ensure that
- the user has access to the site in any kind
- you check if “pInfo” in this example is not null before using it in code
SPPrincipalInfo pinfo = SPUtility.ResolvePrincipal(web, "John Smith", SPPrincipalType.User, SPPrincipalSource.All, web.AllUsers, false);
It’s worthy to check what other function SPUtility provides before writing your own methods.
..:: I LIKE SHAREPOINT ::..