In version 4 I run into the following:
I want to check if an object is already in the namemapping tree, and if not, I want to add it.
For this I use:
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">Set objTmp = NameMappingNode.WaitNamedChild("Findthisone&q uot
If IsNull(objTmp) Then
</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">But if the object does not exitst, an error occurs "The parameter is incorrect". Does anyone know what causes this?
Please note that the MappedChildName parameter of the WaitNamedChild function is a custom name of a child object as it is defined in the NameMapping editor. Thus the 'The parameter is incorrect' error message appears due to the fact that there are no objects mapped to the name you specified as a parameter of the WaitNamedChild method. Please see the 'NameMapping.WaitNamedChild' help topic for details.
To check whether an object is already mapped to some name you can use its MappedName property. If the object isn't mapped to a custom name then this property equals ''.
BTW, if you map an object to some custom name from script and this name coincides with the name of an existing mapped item, an error will occur. Thus you can handle this error using the exception handling statements of a scripting language you use (the On Error Resume Next statement for VBScript). Please refer to the 'NameMapping.AddNamedChild' help topic for details.