AdditionalData: IDictionary;
The AdditionalData property returns additional data that can be used on repository connection.
In the current implementation, additional data is present if authentication via OAuth 2.0 protocol is set up. For details about the use of this protocol see the Setting Up Authentication via External Services article. Additional data will include an element with the TOKEN key containing authorization token, and an element with the DATA key containing information about user in the JSON format.
The specified example represents the class that can be used to handle event of repository connection from web service. If there is additional data during connection, it will be displayed in the development environment console.
Add links to the Collection and Metabase system assemblies.
Public Class CustomEvents: ForeMetabaseCustomEvents
Public Sub OnBeforeLogon(Args: IMetabaseOnBeforeLogonArgs);
Var
Doc: IJsonDocument;
Key, Value: String;
DataDict: IDictionary;
Begin
Args.Handled := False;
Args.AllowLogon := True;
Args.ResultMetabase := Args.Metabase;
// View additional data
DataDict := Args.AdditionalData;
For Each Key In DataDict.Keys Do
Value := DataDict.Item(Key);
If Key = "DATA" Then
// Get JSON file and execute required operations with it
Doc := New JsonDocument.Create;
Doc.ReadFromString(Value);
Value := Doc.WriteToString(JsonformatOptions.UnIndented);
End If;
Debug.WriteLine("Key: " + Key + ". Value: " + Value);
End For;
End Sub OnBeforeLogon;
End Class CustomEvents;
See also: