When i call the function:
ADGroupCreate("Group1", "Group one")
I got the following error message:
An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred
in microsoft.visualbasic.dll
Additional information: Unspecified error
Any idea's why I can't use a string for setting the description of a group
by a variable?
Kind regards,
Rody
This is the function I am using.
Function ADGroupCreate(ByVal pstrGroup As String, _
ByVal pstrGroupDescription As
String)
Const ADS_GROUP_TYPE_GLOBAL_GROUP = &H2
Const ADS_GROUP_TYPE_DOMAIN_LOCAL_GROUP = &H4
Const ADS_GROUP_TYPE_UNIVERSAL_GROUP = &H8
Const ADS_GROUP_TYPE_SECURITY_ENABLED = &H80000000
Dim strDirEntry As Object
Dim objOU As Object
Dim objGroup As Object
strDirEntry = "LDAP://dc=domain,dc=com"
objOU = GetObject(strDirEntry)
objGroup = objOU.Create("group", "cn=" & pstrGroup)
objGroup.Put("groupType", ADS_GROUP_TYPE_GLOBAL_GROUP OR
ADS_GROUP_TYPE_SECURITY_ENABLED)
' ***** WHEN I CALL THE NEXT FUNCTION WITHOUT A VARIBLE *****
' ***** IT WORKS WITHOUT PROBLEMS, BUT WITH THE *****
' ***** I RECEIVE AN ERROR MESSAGE
*****
' objOU.Put("description", "Group one")
objOU.Put("description", pstrGroupDescription )
objOU.SetInfo()
Return True
End Function
An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in microsoft.visualbasic.dll
Additional information: Unspecified error