Platform SDK: Active Directory, ADSI, and Directory Services |
The following Microsoft® Visual Basic® code sample shows how to use IADs::GetInfoEx.
Calling GetInfoEx after changing property values but before calling IADs::SetInfo results in losing those changed values. After this call, the cache reflects the property values in the underlying namespace directory store. However, the cache is only updated with the values specifically requested in the GetInfoEx call. Some servers will not return all properties of an object in response to an IADs::GetInfo call; you must do an explicit GetInfoEx call naming these "non-default" properties in order to get them into the cache.
Dim PropArray As Variant Dim Prop As Variant Dim DescList As Variant Dim obj As IADs Set obj = GetObject("LDAP://MyMachine") ' Initialize the array of properties to pass to GetInfoEx PropArray = Array("description", "distinguishedName") ' Make the array a single variant for passing to GetInfoEx Prop = PropArray ' Get just the description and DN properties obj.GetInfoEx Prop, 0 DescList = obj.Get("description") ' Enumerate the descriptions For Each Desc In DescList ' Print the descriptions Deubg.Print (Desc) Next