Based on this statement:
the code blows up after givenName has been assigned...
this line of code:
userEntry.Properties[ "EmployeeNumber" ]
is blowing up and letting you know that there is no property named EmployeeNumber
or that the Value
of EmployeeNumber
is null
. I'm going to bet on the second and so change that line to this:
userEntry.Properties[ "EmployeeNumber" ] as string;
and your employeeNumber
field will be set to null
when it is null
but it won't throw an exception.