Here is my dilemma. Our company has three levels of user - Exec, Staff, and Nonperson (i.e. an account that represents a role and not an individual - such as 'administrator'). Currently this information is in nested groups - i.e. there is an 'Exec' group that
contains 'ny-exec' and 'la-exec', etc. I wrote a script that set the 'employeeType' attribute for members of one of these groups. This code worked fine, here is a snippet:
Dim type As String = IIf(exec.Checked, "Executive", "Staff")
Dim individual As DirectoryEntry = root
'Root is the person's DE from a higher level function
individual.AuthenticationType = AuthenticationTypes.Secure
'user and pass are valid for an administrator of the domain
individual.Username = user
individual.Password = pass
individual.Properties("employeeType").Add(type)
The employeeType attribute gets set properly
However, when I try to update this feature, by replacing the bolded line above with:
individual.Properties("employeeType").value=type
I get the following error:The Active Directory datatype cannot be converted
to/from a native DS datatype Anyone have any advice?
Not sure what you are passing in for the 'type' variable in your code. The attribute 'employeeType' is of Unicode String, so make sure you are passing a string there. Instead of setting the .Value, try the following and it should fix it for you:
if(individual.Properties.Contains("employeeType"))
{
individual.Properties("employeeType")(0) = type
}
yonah
Member
590 Points
118 Posts
I can add a property just fine, but I can't 'Edit'
Aug 13, 2003 06:41 PM|LINK
Dim type As String = IIf(exec.Checked, "Executive", "Staff") Dim individual As DirectoryEntry = root 'Root is the person's DE from a higher level function individual.AuthenticationType = AuthenticationTypes.Secure 'user and pass are valid for an administrator of the domain individual.Username = user individual.Password = pass individual.Properties("employeeType").Add(type)The employeeType attribute gets set properly However, when I try to update this feature, by replacing the bolded line above with:individual.Properties("employeeType").value=typeI get the following error:The Active Directory datatype cannot be converted to/from a native DS datatype Anyone have any advice?dunnry
Star
9098 Points
1806 Posts
Re: I can add a property just fine, but I can't 'Edit'
Aug 13, 2003 08:10 PM|LINK
if(individual.Properties.Contains("employeeType")) { individual.Properties("employeeType")(0) = type }Weblog
The Book
LDAP Programming Help