C#, Display Name with UserPrincipal wont work

283 Views Asked by At

I want to read out the full name of an user. I am developing a WPF application for Windows with .NET 5.

I tried it with this line of code:

String Fullname = UserPrincipal.Current.DisplayName;

That worked fine on my PC, but when I wanted to test it on a company PC, it doesn't work.

Is there an alternative to the UserPrincipal?

I am new to programming and really don't know where to search.

0

There are 0 best solutions below