Directory Services

IADsUser Property Methods

The property methods of the IADsUser interface get or set the properties described in the following table. For more information, see Interface Property Methods.

Properties

Property Description
AccountDisabled

[Visual Basic]
Access: Read/Write
DataType: Boolean

[C++]
HRESULT get_AccountDisabled
([out] VARIANT_BOOL* pfAccountDisabled);
HRESULT put_AccountDisabled
([in] VARIANT_BOOL fAccountDisabled);

A flag to indicate if the account is or should be disabled.
AccountExpirationDate

[Visual Basic]
Access: Read/Write
DataType: DATE

[C++]
HRESULT get_AccountExpirationDate
([out] DATE* pdateAccountExpirationDate);
HRESULT put_AccountExpirationDate
([in] DATE dateAccountExpirationDate);

The date and time after which the user cannot log on.
BadLoginAddress

[Visual Basic]
Access: Read-only
DataType: BSTR

[C++]
HRESULT get_BadLoginAddress
([out] BSTR* pbstrBadLoginAddress);

The last node that is considered a possible intruder (available if Intruder detection is active).
BadLoginCount

[Visual Basic]
Access: Read-only
DataType: LONG

[C++]
HRESULT get_BadLoginCount
([out] LONG* plBadLoginCount);

The number of bad logon attempts since the last reset.
Department

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_Department
([out] BSTR* pbstrDepartment);
HRESULT put_Department
([in] BSTR bstrDepartment);

The department, an organizational unit (OU), within the company to which the user belongs.
Description

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_Description
([out] BSTR* pbstrDescription);
HRESULT put_Description
([in] BSTR bstrDescription);

The text description of the user.
Division

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_Division
([out] BSTR* pbstrDivision);
HRESULT put_Division
([in] BSTR bstrDivision);

The division within a company or organization.
EmailAddress

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_EmailAddress
([out] BSTR* pbstrEmailAddress);
HRESULT put_EmailAddress
([in] BSTR bstrEmailAddress);

The e-mail address of the user.
EmployeeID

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_EmployeeID
([out] BSTR* pbstrEmployeeID);
HRESULT put_EmployeeID
([in] BSTR bstrEmployeeID);

The employee identifier of the user.
FaxNumber

[Visual Basic]
Access: Read/Write
DataType: VARIANT

[C++]
HRESULT get_FaxNumber
([out] VARIANT* pvarFaxNumber);
HRESULT put_FaxNumber
([in] VARIANT varFaxNumber);

The fax number, or numbers, of the user. In Active Directory, this property is single-valued and the VARIANT array has one element.
FirstName

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_FirstName
([out] BSTR* pbstrFirstName);
HRESULT put_FirstName
([in] BSTR bstrFirstName);

The first name of the user.
FullName

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_FullName
([out] BSTR* pbstrFullName);
HRESULT put_FullName
([in] BSTR bstrFullName);

The full name of the user.
GraceLoginsAllowed

[Visual Basic]
Access: Read/Write
DataType: LONG

[C++]
HRESULT get_GraceLoginsAllowed
([out] LONG* plGraceLoginsAllowed);
HRESULT put_GraceLoginsAllowed
([in] LONG lGraceLoginsAllowed);

The number of times the user can log on after the password has expired.
GraceLoginsRemaining

[Visual Basic]
Access: Read/Write
DataType: LONG

[C++]
HRESULT get_GraceLoginsRemaining
([out] LONG* plGraceLoginsRemaining);
HRESULT put_GraceLoginsRemaining
([in] LONG lGraceLoginsRemaining);

The number of grace logons left before the account is locked.
HomeDirectory

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_HomeDirectory
([out] BSTR* pbstrHomeDirectory);
HRESULT put_HomeDirectory
([in] BSTR bstrHomeDirectory);

The home directory of the user.
HomePage

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_HomePage
([out] BSTR* pbstrHomePage);
HRESULT put_HomePage
([in] BSTR bstrHomePage);

The Uniform Resource Locator (URL) for the home page of the user.
IsAccountLocked

[Visual Basic]
Access: Read/Write
DataType: Boolean

[C++]
HRESULT get_IsAccountLocked
([out] VARIANT_BOOL* pfIsAccountLocked);
HRESULT put_IsAccountLocked
([in] VARIANT_BOOL fIsAccountLocked);

A flag that indicates if the account is locked because of intruder detection. For more information and an example that uses this property, see Account Lockout.
Languages

[Visual Basic]
Access: Read/Write
DataType: VARIANT

[C++]
HRESULT get_Languages
([out] VARIANT* pvLanguages);
HRESULT put_Languages
([in] VARIANT vLanguages);

An array of BSTR language names for the user.
LastFailedLogin

[Visual Basic]
Access: Read-only
DataType: DATE

[C++]
HRESULT get_LastFailedLogin
([out] DATE* pdateLastFailedLogin);

The date and time of the last failed network login.
LastLogin

[Visual Basic]
Access: Read-only
DataType: DATE

[C++]
HRESULT get_LastLogin
([out] DATE* pdateLastLogin);

The date and time of the last network login.
LastLogoff

[Visual Basic]
Access: Read-only
DataType: DATE

[C++]
HRESULT get_LastLogoff
([out] DATE* pdateLastLogoff);

The date and time of the last network logoff.
LastName

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_LastName
([out] BSTR* pbstrLastName);
HRESULT put_LastName
([in] BSTR bstrLastName);

The last name of the user.
LoginHours

[Visual Basic]
Access: Read/Write
DataType: VARIANT

[C++]
HRESULT get_LoginHours
([out] VARIANT* pvLoginHours);
HRESULT put_LoginHours
([in] VARIANT vLoginHours);

Time periods for each day of the week during which logons are permitted for the user. Represented as a table of Boolean values for the week, each indicating if that time slot is a valid logon time. Be aware that the representation is provider and directory specific.
LoginScript

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_LoginScript
([out] BSTR* pbstrLoginScript);
HRESULT put_LoginScript
([in] BSTR bstrLoginScript);

The logon script path.
LoginWorkstations

[Visual Basic]
Access: Read/Write
DataType: VARIANT

[C++]
HRESULT get_LoginWorkstations
([out] VARIANT* pvLoginWorkstations);
HRESULT put_LoginWorkstations
([in] VARIANT vLoginWorkstations);

Addresses or names of workstations, of the BSTR data type, from which the user can log on.
Manager

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_Manager
([out] BSTR* pbstrManager);
HRESULT put_Manager
([in] BSTR bstrManager);

The manager of the user.
MaxLogins

[Visual Basic]
Access: Read/Write
DataType: LONG

[C++]
HRESULT get_MaxLogins
([out] LONG* plMaxLogins);
HRESULT put_MaxLogins
([in] LONG lMaxLogins);

The number of simultaneous login sessions allowed.
MaxStorage

[Visual Basic]
Access: Read/Write
DataType: LONG

[C++]
HRESULT get_MaxStorage
([out] LONG* plMaxStorage);
HRESULT put_MaxStorage
([in] LONG lMaxStorage);

The maximum amount of disk space, in kilobytes, that the user can have.
NamePrefix

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_NamePrefix
([out] BSTR* pbstrNamePrefix);
HRESULT put_NamePrefix
([in] BSTR bstrNamePrefix);

Name prefix of the user, for example "Ms.", or "Hon."
NameSuffix

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_NameSuffix
([out] BSTR* pbstrNameSuffix);
HRESULT put_NameSuffix
([in] BSTR bstrNameSuffix);

Name suffix of the user, for example "Jr.", or "III".
OfficeLocations

[Visual Basic]
Access: Read/Write
DataType: VARIANT

[C++]
HRESULT get_OfficeLocations
([out] VARIANT* pvOfficeLocations);
HRESULT put_OfficeLocations
([in] VARIANT vOfficeLocations);

Office location as a BSTR array for the user. For Active Directory, this property is single-valued and the array has one element.
OtherName

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_OtherName
([out] BSTR* pbstrOtherName);
HRESULT put_OtherName
([in] BSTR bstrOtherName);

An additional name, for example, the middle name, for the user.
PasswordExpirationDate

[Visual Basic]
Access: Read/Write
DataType: DATE

[C++]
HRESULT get_PasswordExpirationDate
([out] DATE* pdatePasswordExpirationDate);
HRESULT put_PasswordExpirationDate
([in] DATE datePasswordExpirationDate);

The date and time when the password expires.
PasswordLastChanged

[Visual Basic]
Access: Read-only
DataType: DATE

[C++]
HRESULT get_PasswordLastChanged
([out] DATE* pdatePasswordLastChanged);

The last time the password was changed.
PasswordMinimumLength

[Visual Basic]
Access: Read/Write
DataType: LONG

[C++]
HRESULT get_PasswordMinimumLength
([out] LONG* plPasswordMinimumLength);
HRESULT put_PasswordMinimumLength
([in] LONG lPasswordMinimumLength);

The minimum length of the password.
PasswordRequired

[Visual Basic]
Access: Read/Write
DataType: Boolean

[C++]
VARIANT_BOOL get_PasswordRequired
([out] VARIANT_BOOL* pfPasswordRequired);
HRESULT put_PasswordRequired
([in] VARIANT_BOOL fPasswordRequired);

A flag that indicates if the password is required.
Picture

[Visual Basic]
Access: Read/Write
DataType: VARIANT

[C++]
HRESULT get_Picture
([out] VARIANT* pvarPicture);
HRESULT put_Picture
([in] VARIANT varPicture);

An OctetString array of bytes that hold an image.
PostalAddresses

[Visual Basic]
Access: Read/Write
DataType: VARIANT

[C++]
HRESULT get_PostalAddresses
([out] VARIANT* pvPostalAddresses);
HRESULT put_PostalAddresses
([in] VARIANT vPostalAddresses);

Postal address as a BSTR array. This property is multi-valued to hold more than addresses of the user. The internal format of a PostalAddress should comply with CCITT F.401 as referenced in X.521-1993, which defines a PostalAddress as six elements of 30 bytes each, holding a street address, (optionally) Post Office Box, city or locality, state or province, Postal Code, and Country/region.
PostalCodes

[Visual Basic]
Access: Read/Write
DataType: VARIANT

[C++]
HRESULT get_PostalCodes
([out] VARIANT* pvPostalCodes);
HRESULT put_PostalCodes
([in] VARIANT vPostalCodes);

Postal codes as a BSTR array. Postal codes are positionally linked to the PostalAddresses array. In Active Directory, however, this property is single-valued and the array has a single element.
Profile

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_Profile
([out] BSTR* pbstrProfile);
HRESULT put_Profile
([in] BSTR bstrProfile);

The path to the user profile.
RequireUniquePassword

[Visual Basic]
Access: Read/Write
DataType: Boolean

[C++]
HRESULT get_RequireUniquePassword
([out] VARIANT_BOOL* pfRequireUniquePassword);
HRESULT put_RequireUniquePassword
([in] VARIANT_BOOL fRequireUniquePassword);

A flag that indicates if a new password should be different from those known through a password history.
SeeAlso

[Visual Basic]
Access: Read/Write
DataType: VARIANT

[C++]
HRESULT get_SeeAlso
([out] VARIANT* pvSeeAlso);
HRESULT put_SeeAlso
([in] VARIANT vSeeAlso);

An array of ADsPaths of other objects related to the user.
TelephoneHome

[Visual Basic]
Access: Read/Write
DataType: VARIANT

[C++]
HRESULT get_TelephoneHome
([out] VARIANT* pvarTelephoneHome);
HRESULT put_TelephoneHome
([in] VARIANT varTelephoneHome);

An array of home telephone numbers of the user. In Active Directory, this property is single-valued and the array has one element.
TelephoneMobile

[Visual Basic]
Access: Read/Write
DataType: VARIANT

[C++]
HRESULT get_TelephoneMobile
([out] VARIANT* pvarTelephoneMobile);
HRESULT put_TelephoneMobile
([in] VARIANT varTelephoneMobile);

An array of mobile telephone numbers of the user. In Active Directory this property is single-valued and the array has one element only.
TelephoneNumber

[Visual Basic]
Access: Read/Write
DataType: VARIANT

[C++]
HRESULT get_TelephoneNumber
([out] VARIANT* pvarTelephoneNumber);
HRESULT put_TelephoneNumber
([in] VARIANT varTelephoneNumber);

An array of, usually work-related, telephone numbers associated with the user. In Active Directory this property is single-valued and the array is of a single element.
TelephonePager

[Visual Basic]
Access: Read/Write
DataType: VARIANT

[C++]
HRESULT get_TelephonePager
([out] VARIANT* pvarTelephonePager);
HRESULT put_TelephonePager
([in] VARIANT varTelephonePager);

An array of pager numbers of the user. In Active Directory this property is single-valued and the array is of a single element.
Title

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_Title
([out] BSTR* pbstrTitle);
HRESULT put_Title
([in] BSTR bstrTitle);

The title of the user.

Remarks

The WinNT provider supplied by Microsoft does not support all the IADsUser property methods as presented above. However, the provider supports other properties that can be accessed using the IADs::Get or IADs::Put method. For more information and a list of unsupported properties and code examples, see WinNT User Object in ADSI WinNT Provider.

For more information about ADSI LDAP provider specific features of the user class object, see LDAP User Object in ADSI LDAP Provider. The topic includes IADsUser, as well as code examples for managing a user account.

Example Code [Visual Basic]

The following code example shows how to bind to a user account object and retrieve the full name of the user.

Dim usr As IADsUser
Dim sFullName as String

On Error GoTo Cleanup
Set usr = GetObject("WinNT://Fabrikam/JeffSmith,user")
sFullName = usr.FullName

Cleanup:
	If (Err.Number<>0) Then
		MsgBox("An error has occurred. " & Err.Number)
	End If

	Set usr = Nothing

Example Code [C++]

The following code example shows how to bind to a user account object and retrieve the full name of the user.

IADsUser *GetUserObject(LPWSTR uPath)
{
	IADsUser *pUser;
	HRESULT hr = ADsGetObject(uPath,IID_IADsUser,(void**)&pUser);
	if (FAILED(hr)) {return NULL;}
	BSTR bstr;
	hr = pUser->get_FullName(&bstr);
	printf("User: %S\n", bstr);
	SysFreeString(bstr);
	return pUser;
}

Requirements

Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Iads.h.

See Also

IADsUser, Interface Property Methods, IADs::Get, IADs::Put, WinNT User Object, ADSI WinNT Provider, LDAP User Object, ADSI LDAP Provider