Reputation: 11
On our company network, Windows user names are like DomainXX\U12312
, however our Windows accounts have actual names and surnames attached to them.
In my previous .NET Framework 4.6 projects, I could use System.DirectoryServies.AccountManagement
as in the answer below:
However, when converting to .NET 7-windows and adding System.DirectoryServices.AccountManagement
(8.0.0, which should be compatible), every single property is throwing a PlatformNotSupportedException
.
What could an alternative route be to obtain actual Windows first name and surname?
I've read other replies that updating System.DirectoryServies.AccountManagement
to match target framework and also make sure that target framework has the -windows suffix
<TargetFramework>net7.0-windows</TargetFramework>
however this is not solving anything
Upvotes: 0
Views: 54
Reputation: 40988
This GitHub issue says that it's just not supported in UWP projects, so if your project is UWP, it's just not possible.
If it's not a UWP project, you can try adding the Microsoft.Windows.Compatibility
NuGet package.
Upvotes: 1