How to: Check for Existing Attributes
The provisioning method that you create for Forefront Identity Manager Synchronization Service (FIM Synchronization Service) throws an exception if you try to access an attribute that was not selected in the attribute inclusion list. This topic demonstrates one technique that you can use to avoid this problem.
The following examples show how to catch the exception that is raised when you try to access an attribute that was not included in the attribute inclusion list.
Public Function IsAttributeAvailable(ByVal csentry As CSEntry, ByVal AttribName As String) As Boolean
Try
IsAttributeAvailable = csentry(AttribName).IsPresent
Catch ex As AttributeNotInInclusionListException
IsAttributeAvailable = False
End Try
End Function
bool IsAttributeAvailable(CSEntry csentry, string AttribName)
{
try
{
return(csentry[AttribName].IsPresent);
}
catch(AttributeNotInInclusionListException ex)
{
return(false);
}
}
See Also
Concepts
Creating and Checking Attribute Values
Using Rules Extensions