Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get UserName in a Windows 10 C# UWP Universal Windows app

Tags:

c#

windows

uwp

I am struggling with yet another simple task in the Windows 10 UWP world.

I simply need the UserName of the current Windows user. Environment.UserName is just not a thing in UWP. And no amount of searching the web has helped so far. Hence my post here.

Anyone? Is this just not possible now?

like image 985
Ian GM Avatar asked Oct 28 '15 14:10

Ian GM


Video Answer


1 Answers

// get username
public string UserNameStr { get; set; } = WindowsIdentity.GetCurrent().Name;

This will get you the full domain\username.

like image 169
Ebey Tech Avatar answered Sep 30 '22 05:09

Ebey Tech