IUserEmails.Add

Fore Syntax

Add(Name: String; Email: String): IUserEmail;

Fore.NET Syntax

Add(Name: String; Email: String): Prognoz.Platform.Interop.Metabase.IUserEmail;

Parameters

Name. Name of the created record.

Email. Value of the address.

Description

The Add method adds a record about the user email to the collection and returns its parameters.

Comments

The name of the record must be unique. If on executing the value of the Name parameter the name of the existing record is specified then the exception is generated.

Fore Example

Sub UserProc;
Var
    Mb: IMetabase;
    User: IMetabaseUser;
    Prof: IUserProfile;
    Email: IUserEmail;
Begin
    Mb := MetabaseClass.Active;
    User := Mb.LogonSession.User;
    Prof := User.Profile.Edit;
    Email := Prof.Emails.Add("Default""user_mail@example.ru");
    Email.SetDefault;
    Prof.Apply;
End Sub UserProc;

On executing the example the profile of the user who logged in the repository is changed. The record with the email address will be added to the profile. This address will be set as the default for the user.

Fore.NET Example

The specified procedure is an entry point for the .NET assembly.

Public Shared Sub Main(Params: StartParams);
Var
    Mb: IMetabase;
    User: IMetabaseUser;
    Prof: IUserProfile;
    Email: IUserEmail;
Begin
    Mb := Params.Metabase;
    User := Mb.LogonSession.User;
    Prof := User.Profile.Edit();
    Email := Prof.Emails.Add("Default""user_mail@example.ru");
    Email.SetDefault();
    Prof.Apply();
End Sub;

On executing the example the profile of the user who logged in the repository is changed. The record with the email address will be added to the profile. This address will be set as the default for the user.

See also:

IUserEmails