I’m experiencing some strange problems coding in LotusScript when I am dealing with LDAP and Active Directory (AD) access. Here are parts of the code:
- sADsPath = “LDAP://ou=XXX Groups,DC=xxx,DC=xyz,DC=com,DC=au”
2 Set oLDAP = GetObject(“LDAP:”)
- Set oOU =
oLDAP.OpenDSObject(sADsPath,“userid”,“xxxxxxxx”,ADS_SECURE_AUTHENTICATION)
-
Set oGroup = oOU.Create(“Group”,“cn=” & p_sGroup)
-
oGroup.Put “sAMAccountName”,p_sGroup
-
oGroup.Put “groupType”,ADS_GROUP_TYPE_LOCAL_GROUP +
ADS_GROUP_TYPE_SECURITY_ENABLED
- oGroup.SetInfo
It seems to occur everytime I invoke the Put() method of an AD group object. When I invoke the method and pass in a string variable as shown in Example 1, I get an error 213 and an error message of “OLE: Automation object error” on execution of the Put() method.
Example 1:
Dim sGroup As String
sGroup = “XXX”
oGroup.Put “sAMAccountName”,sGroup
However, everything works correctly if I pass in the information as a hard coded string, a string constant, or have the variable declared as a variant instead of a string as shown in Example 2.
Example 2:
Dim vGroup As Variant
vGroup = “XXX”
oGroup.Put “sAMAccountName”,vGroup
As a question of curiosity, can anybody explain to me why the Put() method is throwing errors when I pass in a string variable as an argument?