Yes, It’s possible to retrieve the LoginName of a user if you only have the DisplayName ( Last Name + First Name ).
There are a lot of ways to achieve that like :
- You can directly query the Active Directory.
- You can use a PeopleEditor control, which will grab the user if you type in the lastname, firstname combination as follows :
PeopleEditor people = new PeopleEditor(); people.MultiSelect = false;
int userID = Int32.Parse((((PickerEntity)people.ResolvedEntities).EntityData[“SPUserID”]).ToString());
SPUser user = SPContext.Current.Site.RootWeb.SiteUsers.GetByID(userID);
- You can use SharePoint Search API ( FullTextSqlQuery Class ) :
SELECT AccountNameFROM portal..scope()WHERE ( (“SCOPE” = ‘People’) ) AND (“Title” = ‘[DISPLAY NAME]’)
I prefer the third way, much easier.