This project has moved. For the latest updates, please go here.

Add property %UserDisplayName% that expands to full user name, e.g., John Smith

Nov 27, 2013 at 6:15 PM
The similar property %UserName% already exists, but it is expanded to a login of the current user. It will be good to have another property that will be expanded to displayed name of the current user obtained from the local machine or a domain. This information can be retrieved with the following line of code:
string displayName = UserPrincipal.Current.DisplayName;
This will allow providing license headers with real names of developers, not just their logins, for example, when user login is "jsm" while displayed name is John Smith.
Coordinator
Nov 28, 2013 at 6:48 AM
Does UserPrincipal.Current also work when the current user is not a domain user (but just an ordinary Windows user)?
If not, one could use P/Invoke to call GetUserNameEx, see e.g., http://www.developerzen.com/2007/06/07/getting-the-full-name-of-the-current-user/ (second approach).
Nov 28, 2013 at 4:31 PM
Fabian, thank you very much for the question and proposal of the alternative solution based on PInvoke.
Yes, UserPrincipal.Current.DisplayName works both for domain users and local machine users (ordinary Windows users).
Please let me know if the functionality of %UserDisplayName% property is useful.
Coordinator
Dec 2, 2013 at 7:29 AM
Well, if it is useful to you, it might also be useful to others. Can you add an feature request in the issue tracker?
If you want, you can also provide a pull request. That would make it more likely to be included in the next LHM release. (Which currently has no planned release date, but I guess it will come when a few bugfixes and new features have been implemented.)
Dec 2, 2013 at 6:39 PM
I created correspondent work item #34.
Dec 2, 2013 at 6:53 PM
I suppose I will create a pull request this week.