Invalid user credentials opening a login popup using the Automation API

I have one request regarding the Enterprise Architect Automation API. I am using the below C # snippet to connect to Enterprise Architect

         EA.Repository EARepository = new EA.Repository();
         bool isOpen = EARepository.OpenFile2("C:/EAProjects/SampleProject.eap", "admin", "password");

      

If in the above code the password is incorrect, as soon as the second line launches the popup, it asks for the correct credentials, and the isOpen variable is still not initialized or changed to false.

Is there a way to find out if the provided credentials are valid or not using the Automation API.

What we wanted is, once the wrong credentials are provided to connect to the repository, it should throw an error or return some value indicating that the provided credentials are invalid and shouldn't ask for any user interaction, so there is a way achieve this.

Actually I want to run this code in the background without any user interaction. I checked the EA documentation but didn't get it.

+3


source to share


1 answer


Try Repository.SuppressSecurityDialog = true

The documentation says:



Prevent the login prompt dialog that appears by default when the username and password parameters passed to OpenFile2 are invalid. For use only by external automation clients.

So I think it's right up your alley

+3


source







All Articles