Microsoft Identity Integration Server 2003 Developer Reference |
During the provisioning step, we recommend that you verify that on a metaverse object, certain attribute values exist prior to continuing with the provisioning logic.
The following example shows you how to verify that an object has
the attribute and attribute values that are required before
provisioning logic creates new connectors. This specific example
will verify that the employeeStatus attribute is present and
contains either active
or inactive
.
If the employeeStatus attribute is not present or
contains a value other than active
or
inactive
, the example will throw an UnexpectedDataException
exception. The UnexpectedDataException exception will cause
the "extension-unexpected-attribute-value" error to be displayed in
the Identity Manager for the management agent.
Public Sub Provision(ByVal mventry As MVEntry) Implements IMVSynchronization.Provision If (Not mventry("employeeStatus").IsPresent) Then Throw New UnexpectedDataException("employeeStatus is not present.") End If ' Employee Status can be either "active" or "inactive". Throw an ' exception for a value other than active or inactive. Dim strEmployeeStatus As String strEmployeeStatus = mventry("employeeStatus").Value.ToLower Select Case (strEmployeeStatus) Case "active", "inactive" System.Diagnostics.Trace.WriteLine("Valid employeeStatus value: " + strEmployeeStatus) Case Else Throw New UnexpectedDataException("Invalid employeeStatus value: " + strEmployeeStatus) End Select End Sub
void IMVSynchronization.Provision(MVEntry mventry) { if(!mventry["employeeStatus"].IsPresent) { throw new UnexpectedDataException("employeeStatus not present."); } // Employee Status can be either "active" or "inactive". Throw an // exception for a value other than active or inactive. string strEmployeeStatus = mventry["employeeStatus"].Value.ToLower(); switch(strEmployeeStatus) { case "active": case "inactive": System.Diagnostics.Trace.WriteLine("Valid employeeStatus value: " + strEmployeeStatus); break; default: throw new UnexpectedDataException("Invalid employeeStatus value: " + strEmployeeStatus); } }