Retrieve Credentials from Windows Credentials Store using C#

There is a Nuget library called CredentialManagement that wraps the Windows Credential Management API that supports both the old and the new style of UI


works perfectly

        var cm = new Credential();
        cm.Target = "mycredentialname";

        if (!cm.Exists())
            Console.WriteLine("cm is null");
        Console.WriteLine("Password: " + cm.Password);
        Console.WriteLine("Username: " + cm.Username);