The GetInfo Method

The IADs::GetInfo method loads all of the attribute values for an ADSI object into the local cache from the underlying directory service. The IADs::GetInfoEx method is used to load specific attribute values into the local cache. For more information about using the IADs::GetInfoEx method, see Optimization Using GetInfoEx.

ADSI will make an implicit IADs::GetInfo call when the IADs::Get or IADs::GetEx method is called for a specific attribute and no value is found in the local cache. When IADs::GetInfo has been called, an implicit call is not repeated. If a value already exists in the property cache, however, calling the IADs::Get or IADs::GetEx method without first calling IADs::GetInfo will retrieve the cached value rather than the most current value from the underlying directory. This can cause updated attribute values to be overwritten if the local cache has been modified but the values have not been committed to the underlying directory service with a call to the IADs::SetInfo method. To avoid caching problems, commit attribute value changes by calling IADs::SetInfo before calling IADs::GetInfo.

Dim usr As IADs

' Bind to a specific user object.
Set usr = GetObject("LDAP://CN=Jeff Smith,CN=Users,DC=fabrikam,DC=com")
 
' This code example assumes that the property description has a single value in the directory.
' Be aware that this will IMPLICITLY call GetInfo because at this point GetInfo
' has not yet been called (implicitly or explicitly) on the usr object.
Debug.Print "User's title is " + usr.Get("title")

' Change the attribute value in the local cache.
usr.Put "title", "Vice President"
Debug.Print "User's title is " + usr.Get("title")

' Call GetInfo, which will overwrite the updated value because SetInfo has not 
' been called.
usr.GetInfo
Debug.Print "User's title is " + usr.Get("title")

Some directory services do not return all attribute values for an object in response to a IADs::GetInfo call. In these cases, use the IADs::GetInfoEx method to load these values into the local cache.