Open(Credentials: ICredentials; [Mode: ApplicationMode = 0]; [CurrentLocale: LocaleCodeID = 0]): IMetabase;
Credentials - the credentials, used when connecting.
Mode - a non-mandatory parameter that defines the mode of connection to the repository.
CurrentLocale - a non-mandatory parameter that defines the repository language that is used when connecting.
The Open method performs connection to the repository according to the specified parameters.
Executing the example requires a form, the Button1 button on this form, and the MetabaseTreeList component named MetabaseTreeList1. Settings of platform connection 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;
Cre: ICredentials;
Begin
MB := MetabaseClass.Active;
MAN := MB.Definition.Manager;
Cre := MAN.Packs.Item(0).Package.CreateCredentials(AuthenticationMode.Password);
Def := MAN.Definitions.FindById("Test");
(Cre As IPasswordCredentials).UserName := "Test";
(Cre As IPasswordCredentials).Password := "Test";
MB := Def.Open(Cre, 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 Test repository as a root for the MetabaseTreeList1 component. English (USA) is set as a repository language.
See also: