IMAExtensible2Password.SetPassword Method

Sets the password for the connector space object.

Namespace: Microsoft.MetadirectoryServices
Assembly: Microsoft.MetadirectoryServicesEx (in Microsoft.MetadirectoryServicesEx.dll)

Usage

'Usage
Dim instance As IMAExtensible2Password
Dim csentry As CSEntry
Dim newPassword As SecureString
Dim options As PasswordOptions

instance.SetPassword(csentry, newPassword, options)

Syntax

'Declaration
Sub SetPassword ( _
    csentry As CSEntry, _
    newPassword As SecureString, _
    options As PasswordOptions _
)
void SetPassword (
    CSEntry csentry,
    SecureString newPassword,
    PasswordOptions options
)
void SetPassword (
    CSEntry^ csentry, 
    SecureString^ newPassword, 
    PasswordOptions options
)
void SetPassword (
    CSEntry csentry, 
    SecureString newPassword, 
    PasswordOptions options
)
function SetPassword (
    csentry : CSEntry, 
    newPassword : SecureString, 
    options : PasswordOptions
)

Parameters

  • csentry
    Contains a CSEntry object specifying the object on which to set the password.
  • newPassword
    Contains a string with the new password.
  • options
    Contains a PasswordOptions object specifying the options for setting the password.

Remarks

Sets the password for the connector space object csentry. It can be assumed that OpenPasswordConnection has been called successfully. The initial password is stored in an attribute called export_password which is encrypted.

The following PasswordOptions options are available:

Option Description

None = 0x00

No options

ForceChangeAtLogOn = 0x01

This option sets the users password and forces the user to change the password at next log on.

UnlockAccount = 0x02

Unlock the account in addition to setting the password.

ValidatePassword = -0x04

Validate the password before setting the password.

Exceptions: Return values, Errors, and Exceptions

The following is an example of SetPassword:

  public void SetPassword(CSEntry csentry, string NewPassword, PasswordOptions options)
        {
            //
            // NOTE: If the directory in which the set operation is occurring on
            // needs to be serialized, one would add code here to grab the 
            // lock prior to performing the functionality below and 
            // release it immediately after its done.
            // As an example, one could accomplish this by using the Mutex class.
            // 
            m_xmlWriterExport.WriteStartElement(Nodes.Object);
 
            m_xmlWriterExport.WriteElementString(
                Nodes.Name,
                csentry.DN.ToString()
                );
 
            m_xmlWriterExport.WriteElementString(
                Nodes.Operation,
                "SetPassword"
                );
 
            m_xmlWriterExport.WriteElementString(
                Nodes.NewPassword,
                NewPassword
                );
 
            m_xmlWriterExport.WriteEndElement();
        }

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003 , Windows Server 2008, and Windows 2000

Target Platforms

Change History

See Also

Reference

IMAExtensible2Password Interface
IMAExtensible2Password Members
Microsoft.MetadirectoryServices Namespace