Open(Credentials: ICredentials; [Mode: ApplicationMode = 0]; [CurrentLocale: LocaleCodeID = 0]): IMetabase;
Credentials. User credentials used on connection.
Mode. Optional parameter that determines repository connection mode.
CurrentLocale. Optional parameter that determines a repository language used on connection.
The Open method performs connection to the repository according to the specified parameters.
Executing the example requires a form, a button on the form, and the MetabaseTreeList component named MetabaseTreeList1. Platform connection settings include description of the Test repository. When connecting to it, user name and the Test password are used.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
MB: IMetabase;
MAN: IMetabaseManager;
Def: IMetabaseDefinition;
PwdCred: IPasswordCredentials;
Begin
MB := MetabaseClass.Active;
MAN := MB.Definition.Manager;
PwdCred := MAN.Packs.Item(0).Package.CreateCredentials(AuthenticationMode.Password) As IPasswordCredentials;
Def := MAN.Definitions.FindById("Test");
PwdCred.UserName := "Test";
PwdCred.Password := "Test";
MB := Def.Open(PwdCred, ApplicationMode.Win, LocaleCodeID.English_UnitedStates);
MetabaseTreeList1.Root := MB.Root;
End Sub Button1OnClick;
After executing the example, pressing the button sets the root folder of the specified repository as a root for the MetabaseTreeList1 component. English (USA) is set as a repository language.
See also: