How do we get workgroup name from windows 10 in uwp?

陌路散爱 提交于 2019-12-12 00:38:12

问题


How do we get workgroup name from windows 10 in uwp

and all other attribute of user?


回答1:


There is a User class available (UWP): https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.user.aspx

There you can find the attributes of the user




回答2:


You can use NetworkInformation class

For example to get computer name use:

var hostNames = NetworkInformation.GetHostNames();
var localName = hostNames.FirstOrDefault(name => name.DisplayName.Contains(".local"));
var computerName = localName.DisplayName.Replace(".local", "");

Or you can also use ConnectionProfile to get information about network.
Try something like this:

var result = NetworkInformation.GetConnectionProfiles();
foreach (var connectionProfile in result)
{
    foreach (var networkName in connectionProfile.GetNetworkNames())
    {
        // use networkName;
    }
}


来源:https://stackoverflow.com/questions/36692062/how-do-we-get-workgroup-name-from-windows-10-in-uwp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!