IADs Method: Put

PropertyName As String,
PropertyValue As Variant


[in] String PropertyName
Name of the property of an object. The name is case sensitive and must be enclosed in double quotes. Allowable values for PropertyName depend on the type of IADs object .

[in] Variant PropertyValue
Value that has to be set for the property of an object.

This method sets the value for the specified property by name.

While using the Put method in VB or VBScript, ensure that the Variant (second) parameter contains data of the appropriate type required by the property. (The name of the property is passed in the first parameter.) This can be done by assigning a variable of the appropriate type to a Variant, and then passing the Variant to Put.

Consider the PasswordHistoryLength property of the Domain object. This is of type Long. The following lines of Visual Basic code set the value for this property using the Put method.

Dim HistLength As Long
Dim VarArg As Variant
Dim Domain As IADsDomain
'Get the domain object (assuming that MSFT is a valid domain)
Set Domain = GetObject("NTDS://MSFT")
HistLength = 5
'Assign the Long variable to the Variant to ensure that the proper data type is set
VarArg = HistLength
'Invoke the Put method with the appropriate Variant type that has been set
Domain.Put "PasswordHistoryLength", VarArg


See Also