大网数据广告活动
域与目录服务

The GetInfo Method

· 52CE 我爱测

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::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.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。