Wrong user credentials opening login popup with automation API

155 Views Asked by At

I have one query regarding the automation API of Enterprise Architect. I am using the below c# snippet for connecting to Enterprise Architect

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

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

Is there a way to know that whether the provided credentials are valid or not using automation API.

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

Actually I want to run this code in background without any user interaction. I have checked the EA documentation but no clue.

1

There are 1 best solutions below

0
On BEST ANSWER

Try Repository.SuppressSecurityDialog = true

The documentation says:

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

So I guess that is right up your alley