0

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:

Get Windows User Display Name

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

1

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.