Partager via


IMAExtensible2Password.ChangePassword Method

Changes the password for the connector space object csEntry.

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

Usage

'Usage
Dim instance As IMAExtensible2Password
Dim csentry As CSEntry
Dim oldPassword As SecureString
Dim newPassword As SecureString

instance.ChangePassword(csentry, oldPassword, newPassword)

Syntax

'Declaration
Sub ChangePassword ( _
    csentry As CSEntry, _
    oldPassword As SecureString, _
    newPassword As SecureString _
)
void ChangePassword (
    CSEntry csentry,
    SecureString oldPassword,
    SecureString newPassword
)
void ChangePassword (
    CSEntry^ csentry, 
    SecureString^ oldPassword, 
    SecureString^ newPassword
)
void ChangePassword (
    CSEntry csentry, 
    SecureString oldPassword, 
    SecureString newPassword
)
function ChangePassword (
    csentry : CSEntry, 
    oldPassword : SecureString, 
    newPassword : SecureString
)

Parameters

  • csentry
    Contains a CSEntry object specifying the user.
  • oldPassword
    Contains a string with the old password.
  • newPassword
    Contains a string with the new password.

Remarks

It can be assumed that OpenPasswordConnection has been called successfully.

Exceptions: Return values, Errors, and Exceptions

The following is an example of ChangePassword:

 public void ChangePassword(CSEntry csentry, string OldPassword, string NewPassword)
        {
            //
            // 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,
                "ChangePassword"
                );
 
            m_xmlWriterExport.WriteElementString(
                Nodes.OldPassword,
                OldPassword
                );
 
            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

Target Platforms

Change History

See Also

Reference

IMAExtensible2Password Interface
IMAExtensible2Password Members
Microsoft.MetadirectoryServices Namespace