Platform SDK: Active Directory, ADSI, and 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 in Vtable Order

Property Description
AccountDisabled

[Visual Basic]
Access: Read/Write
Data Type: BOOLEAN

[C++]
HRESULT get_AccountDisabled
([out] BOOLEAN *pbAccountDisabled);


HRESULT put_AccountDisabled
([in] BOOLEAN bAccountDisabled);

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

[Visual Basic]
Access: Read/Write
Data Type: DATE

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


HRESULT put_AccountExpirationDate
([in] DATE dateAccountExpirationDate);

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

[Visual Basic]
Access: Read
Data Type: 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
Data Type: LONG

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

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

[Visual Basic]
Access: Read/Write
Data Type: 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
Data Type: 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
Data Type: BSTR

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


HRESULT put_Division
(
[in] BSTR bstrDivision);

The division within a company (organization).
EmailAddress

[Visual Basic]
Access: Read/Write
Data Type: BSTR

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


HRESULT put_EmailAddress
([in] BSTR bstrEmailAddress);

The user's e-mail address.
EmployeeID

[Visual Basic]
Access: Read/Write
Data Type: 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
Data Type: VARIANT

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


HRESULT put_FaxNumber
([in] VARIANT varFaxNumber);

The fax 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
Data Type: 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
Data Type: 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
Data Type: 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
Data Type: 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
Data Type: BSTR

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


HRESULT put_HomeDirectory
([in] BSTR bstrHomeDirectory);

The user's home directory.
HomePage

[Visual Basic]
Access: Read/Write
Data Type: BSTR

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


HRESULT put_HomePage
([in] BSTR bstrHomePage);

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

[Visual Basic]
Access: Read/Write
Data Type: BOOLEAN

[C++]
HRESULT get_IsAccountLocked
([out] BOOLEAN *pbIsAccountLocked);


HRESULT put_IsAccountLocked
([in] BOOLEAN bIsAccountLocked);

A flag indicating if the account is locked because of intruder detection.
Languages

[Visual Basic]
Access: Read/Write
Data Type: 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
Data Type: DATE

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

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

[Visual Basic]
Access: Read
Data Type: DATE

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

The date and time of the last network login.
LastLogoff

[Visual Basic]
Access: Read
Data Type: DATE

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

The date and time of the last network logoff.
LastName

[Visual Basic]
Access: Read/Write
Data Type: BSTR

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


HRESULT put_LastName
([in] BSTR bstrLastName);

The user's last name.
LoginHours

[Visual Basic]
Access: Read/Write
Data Type: 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 Booleans for the week, each indicating if that time slot is a valid logon time.
LoginScript

[Visual Basic]
Access: Read/Write
Data Type: BSTR

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


HRESULT put_LoginScript
([in] BSTR bstrLoginScript);

The logon script path.
LoginWorkstations

[Visual Basic]
Access: Read/Write
Data Type: 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
Data Type: 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
Data Type: 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
Data Type: 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
Data Type: 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
Data Type: 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
Data Type: 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
Data Type: 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
Data Type: 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
Data Type: DATE

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

The last time the password was changed.
PasswordMinimumLength

[Visual Basic]
Access: Read/Write
Data Type: LONG

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


HRESULT put_PasswordMinimumLength
([in] LONG lPasswordMinimumLength);

The minimum password length.
PasswordRequired

[Visual Basic]
Access: Read/Write
Data Type: BOOLEAN

[C++]
HRESULT get_PasswordRequired
([out] BOOLEAN *plPasswordRequired);


HRESULT put_PasswordRequired
([in] BOOLEAN lPasswordRequired);

A flag indicating if the password is required.
Picture

[Visual Basic]
Access: Read/Write
Data Type: 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
Data Type: 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.
PostalCodes

[Visual Basic]
Access: Read/Write
Data Type: 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
Data Type: 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
Data Type: BOOLEAN

[C++]
HRESULT get_RequireUniquePassword
([out] BOOLEAN *plRequireUniquePassword);


HRESULT put_RequireUniquePassword
([in] BOOLEAN lRequireUniquePassword);

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

[Visual Basic]
Access: Read/Write
Data Type: 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
Data Type: 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
Data Type: 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
Data Type: 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
Data Type: 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
Data Type: 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 the list of unsupported properties, code examples, and other information, see WinNT User Object in ADSI WinNT Provider.

The ADSI LDAP provider specific features of the user class object is discussed in LDAP User Object in ADSI LDAP Provider. The topic includes Mapping between IADsUser Properties and Active Directory Properties, as well as code examples for managing user account.

Example Code [Visual Basic]

The following Visual Basic code snippet shows how to bind to a user account object and retrieve the user's full name.

Dim usr As IADsUser
Set usr = GetObject("WinNT://Microsoft/JSmith,user")
fulNamb = usr.FullName

Example Code [C++]

The following C++/C code snippet shows how to bind to a user account object and retrieve the user's full name.

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;
}

See Also

IADsUser, Interface Property Methods, IADs::Get, IADs::Put, WinNT User Object, ADSI WinNT Provider, LDAP User Object, ADSI LDAP Provider, Mapping between IADsUser Properties and Active Directory Properties