Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I pass a Variant?
Message
 
 
To
21/10/2003 11:21:09
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00840682
Message ID:
00841245
Views:
19
>I'm helping someone automate user login creation, and they want to add new members to an existing group.
>
>The PutEx() function I need to call is defined as:
>Method PutEx(lnControlCode As Long, bstrName As String, vProp As Variant) As Void
>
>The example code gives vProp as [Array("cn=userid1, dc=domain, dc=com", "cn=userid2, dc=domain, dc=com)] to add userid1 and userid2 to previously selected group.
>
>Various attempts to pass vProp with the string "Array" included have failed with OLE IDispatch exception code 0 from Active Directory: Unspecified Error.
>
>How can I pass it what it is expecting from FoxPro?

Chris,
Where do you need to call this? If I understand you correctly, the following will do what you want:
local locomputer, louser, logroup
locomputer = getobject('WinNT://MyDomain/MyComputer,computer')
louser = locomputer.Create('user','NewUser')
louser.SetPassword('mynewpassword')  && this is done in case you have password constraints/restrictions
louser.SetInfo()

logroup = getobject('WinNT://MyDomain/MyComputer/GroupName,group')
logroup.Add('WinNT://MyDomain/MyComputer/NewUser')
Does it need to do something else that I'm missing?

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform