Skip to content

PowerShell Connector Schema ​

Overview ​

The schema defines the attributes in the entities managed by the connector. As with all connectors this schema can be configured through the standard UNIFYConnect user interface; but the PowerShell connector supports the ability to request the schema from a target system. This capability is exposed through a single Schema Provider__script.

Implementation ​

If the schema of the entities is dynamically defined in the target system, it can be requested through a schema provider script.

A schema consists of a series of fields. Each field maintains the following properties:

  • Name: The name-value of the field. (e.g. PhoneNumber, FirstName, LastName etc.)
  • Type: The type of data managed by the field which can be any of the following:
    • Single Valued: boolean, binary, timestamp, date, decimal, dn, guid, int, long, double, short, single, string, complex
    • Multi-Valued: boolean.multi, timestamp.multi, date.multi, decimal.multi, dn.multi, guid.multi, int.multi, long.multi, double.multi, short.multi, single.multi, string.multi, complex.multi
  • Key: Whether this field is part of the key of the connector. The key is used to uniquely identify entities of a connector.
  • Read-only: Whether this field can only be read from the target system (values will not be exported)
  • Required: Whether a value must be present in this field for it to be registered by UNIFYConnect.

A field can be dynamically registered in the schema provider script through the following method:

Powershell
function New-Field([string]$fieldName, [string]$type, [bool]$key, [bool]$readOnly = $false, [bool]$required = $false)

Example ​

The following example implementation is for a hypothetical Student table. Each student has a first name, last name, email address, year level and a series of email addresses. Additionally, there is a unique identifier for each student in the database:

Powershell
New-Field 'UniqueIdentifier' 'int' $true $true $true;
New-Field 'FirstName' 'string' $false $true $true;
New-Field 'LastName' 'string' $false $true $true;
New-Field 'EmailAddress' 'string' $false $false $false;
New-Field 'YearLevel' 'int' $false $false $true;
New-Field 'PhoneNumbers' 'string.multi' $false $false $false;

Registering this schema provider script will force the connector to evaluate it, and generate the subsequent schema.