OpenDefault(Credentials: ICredentials): IMetabase;
Credentials - the credentials, used when connecting.
The OpenDefault method performs connection to the repository. The settings, established for the repository by default, are used when connecting.
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.OpenDefault(Cre);
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. The settings, saved for the repository by default, are set for the repository when connecting.
See also: