I am using Windows 10 machine and Visual studio 2015 for a project which has Windows Run time component and Universal Windows application (UWA). UWA has reference of Windows Runtime component which perform a task to get UserIdentity (Window NT ID i.e. "DomainName/UserName") of logged in user. UWA test project is created to debug the Runtime component. If we get UserIdentity in runtime component so we can use component reference to our Windows10 cordova project to get UserIdentity in javascript.
Here we are facing issue where none of the code is working to get logged in user's DomainName/username. We have upgraded this code from Windows 8.1 to 10 wears this code is working great with Windows 8.1 but having issue in Windows 10. Below is the code which we are using to get UserIdentity:
public sealed class getNTID
{
public static IAsyncOperation<string> DownloadAsStringsAsync()
{
return Task.Run<string>(async () =>
{
IReadOnlyList<User> users = await User.FindAllAsync();
var current = users.Where(p => p.AuthenticationStatus == UserAuthenticationStatus.LocallyAuthenticated &&
p.Type == UserType.LocalUser).FirstOrDefault();
var data = await current.GetPropertyAsync(KnownUserProperties.AccountName);
return data.ToString();
}).AsAsyncOperation();
}
}
We are getting empty string in data variable at the end. It would be great if someone share their exeperience or they have faced this kind of issue with mentioned platform.