locked
directoryentry RRS feed

  • Question

  • hi

    i have a problem with the first argument of this methode

    directoryentry.Invoke(???);

    where can i find the methodname that i should post as the first argument??

    what the available methodename?

    Saturday, August 19, 2006 8:46 AM

Answers

  • Forget about delegates, Ahmedilyas thought you were talking about Control.Invoke().  Judging from your post, you're talking about DirectoryEntry.Invoke(), an entirely different method.  To change the password for a user, you would call:
      obj.Invoke("ChangePassword", "OldPassword", "NewPassword")
    where 'obj' references a node in the Active Directory tree that you got from enumerating a DirectoryEntries object.
    Sunday, August 20, 2006 2:49 PM

All replies

  • You'd use the name of the method (String) for the particular Active Directory object you have selected.  For example, a user object has a "ChangePassword" method.  Use InvokeGet/InvokeSet to read/write properties.  Property and method names appear to be documented here

    Hope this puts you on the right track, I couldn't try this myself...

    Saturday, August 19, 2006 8:20 PM
  • hi sorry for creating duplication .......

    but i don't know how can i use this mehtode and delegate may you define a delegate an use that in this method

    my actual problem is that the user in the active directory is it's own password and i should create a delegate to set this password okey????

    how can i set this password in the delegate , and i don't have even an object of this user

    i hope that i can express my problem so that you can help me............

    regards..........

    buy

    Sunday, August 20, 2006 2:20 PM
  • Forget about delegates, Ahmedilyas thought you were talking about Control.Invoke().  Judging from your post, you're talking about DirectoryEntry.Invoke(), an entirely different method.  To change the password for a user, you would call:
      obj.Invoke("ChangePassword", "OldPassword", "NewPassword")
    where 'obj' references a node in the Active Directory tree that you got from enumerating a DirectoryEntries object.
    Sunday, August 20, 2006 2:49 PM
  • yes Nobugz I was thinking about that but more specifically invoking a method. :-) Thanks for clearing that up!
    Sunday, August 20, 2006 3:00 PM
  •  hi dear.thanks for your constructive reply

    i wanted to know about the other methods to set the other properties of user objects.

    and how i can use asp.net to do the same thing.

    some helpfull links ............

    regards

    bye..........

     

    Monday, August 21, 2006 6:20 AM
  • hi again

    you say that i should use this method but there is a problem :

    obj.Invoke("ChangePassword", "OldPassword", "NewPassword")
    you know when at the first time i create a user it doesn't have any password what should i do ??????????? for the second argument?

    thanks ..........................

    bye

    Monday, August 21, 2006 9:50 AM
  • hi ,nobugz.....

    sorry but i don't know what do you mean from InvokeGet/Invokesetyou know that they are take an string for their first argument

    and i don't know what i should do with that

    could you pleas help me with the first argument???????????????

    thanks bye..............

    Monday, August 21, 2006 9:54 AM
  • Try:
      obj.Invoke("ChangePassword", "", "NewPassword")

    Is this stuff working?  I couldn't try it out myself...
    Monday, August 21, 2006 12:47 PM
  • hi all my dear friends:
    i was tired of trying all the ways and see the same exeption .

    please take a look at my code , that i use to add a user to
    active directory :


    DirectoryEntry de = new DirectoryEntry("LDAP://192.168.0.1/cn=Users,dc=soheila,dc=org", "Administrator@soheila.org", "sohama3t", AuthenticationTypes.ServerBind);
    DirectoryEntry de2 = new DirectoryEntry("LDAP://192.168.0.1/cn=Administrator,cn=Users,dc=soheila,dc=org", "Administrator@soheila.org", "sohama3t", AuthenticationTypes.ServerBind);
    DirectoryEntries des = de.Children;
    DirectoryEntry newChild = des.Add("cn=masoud", de2.SchemaClassName);
    newChild.CommitChanges();
    de.CommitChanges();
    de.Close();
    de2.Close();
    newChild.Close();
    DirectoryEntry de3 = new DirectoryEntry("LDAP://192.168.0.1/cn=masoud,cn=Users,dc=soheila,dc=org","Administrator@soheila.org","sohama3t",AuthenticationTypes.ServerBind);
    string ch = "hello hi";
    char[] ch2 = new char[10];
    ch2 = ch.ToCharArray();
    de3.Password = new String(ch2);
    de3.Username = new String("misi@soheila.org".ToCharArray());
    de3.CommitChanges();
    de3.close();   


    and it works without a problem
    but a problem is that the user is Unable at the first
    and manually i can enable that my first question is that
    " How can i enable this user programmatically????????????"
     
    and then i use this piece of code to replace the password
    but at the specified line it throw an exeption and i don't konw why..........


                DirectoryEntry de = new DirectoryEntry("LDAP://192.168.0.1/cn=masoud,cn=Users,dc=soheila,dc=org","Administrator@soheila.org","sohama3t",AuthenticationTypes.ServerBind);
                de.Invoke("ChangePassword","hello hi","second pass");
    ************>       de.CommitChanges();
                de.Close();
               
    my second question is why it throw an exeption ????????????
    and my third question is "is it necessary to use the DirectoryEntry.invoke methode i think that it is a useless method because i can set and get the password and username and the other property by using their own properties?
    what is it's real use ?????????????????? "
     

    thanks for all of your answers my best frinds..........bye

    Monday, August 21, 2006 7:16 PM
  • thanks all

     

    Saturday, August 26, 2006 5:42 AM
  • Hello,

    i have the exception when i tried to execute the code...what was the probleam and how did you fix it?

    thanks

    thaya

    Thursday, October 19, 2006 9:29 PM
  • Hi,

    http://msdn.microsoft.com/en-us/library/aa746340(VS.85).aspx
    Method Description

    get_Name

    Gets the object's relative name.

    get_Class

    Gets the name of the object's schema class.

    get_GUID

    Gets the GUID of the object as stored in the underlying directory store.

    get_ADsPath

    Gets the object's ADsPath that uniquely identifies this object from all others.

    get_Parent

    Gets the ADsPath string for the parent of the object.

    get_Schema

    Gets the ADsPath string to the schema class object for this object.

    GetInfo

    Loads the property values of this object from the underlying directory store.

    SetInfo

    Persists the changes on this object to the underlying directory store.

    Get

    Gets the value for a property by name.

    Put

    Sets the value for a property by name.

    GetEx

    Gets the value for a single or multi-valued property by name.

    PutEx

    Sets the value for a single or multi-valued property by name.

    GetInfoEx

    Loads specific property values of this object from the underlying directory store.

    get_BadLoginAddress

    Gets the address of the last node, considered an "Intruder".

    get_BadLoginCount

    Gets the number of the bad logon attempts since last reset.

    get_LastLogin

    Gets the date and time of the last network login.

    get_LastLogoff

    Gets the date and time of the last network logoff.

    get_LastFailedLogin

    Gets the date and time of the last failed network login.

    get_PasswordLastChanged

    Gets the date and time of the last password change.

    get_Description

    Gets and sets the description of the user account.

    put_Description

    Gets and sets the description of the user account.

    get_Division

    Gets and sets the division within a company (organization).

    put_Division

    Gets and sets the division within a company (organization).

    get_Department

    Gets and sets the organizational unit within the organization.

    put_Department

    Gets and sets the organizational unit within the organization.

    get_EmployeeID

    Gets and sets employee identification number of the user.

    put_EmployeeID

    Gets and sets employee identification number of the user.

    get_FullName

    Gets and sets the full name of the user.

    put_FullName

    Gets and sets the full name of the user.

    get_FirstName

    Gets and sets the first name of the user.

    put_FirstName

    Gets and sets the first name of the user.

    get_LastName

    Gets and sets the last name of the user.

    put_LastName

    Gets and sets the last name of the user.

    get_OtherName

    Gets and sets the additional name, such as the nickname, or the middle name of the user.

    put_OtherName

    Gets and sets the additional name, such as the nickname, or the middle name of the user.

    get_NamePrefix

    Gets and sets the name prefix, such as Mr., Ms., or Hon., of the user.

    put_NamePrefix

    Gets and sets the name prefix, such as Mr., Ms., or Hon., of the user.

    get_NameSuffix

    Gets and sets the name suffix, such as Jr. or III, of the user.

    put_NameSuffix

    Gets and sets the name suffix, such as Jr. or III, of the user.

    get_Title

    Gets and sets the user's title within the organization.

    put_Title

    Gets and sets the user's title within the organization.

    get_Manager

    Gets and sets the manager of the user.

    put_Manager

    Gets and sets the manager of the user.

    get_TelephoneHome

    Gets and sets the list of home phone numbers of the user. In Active Directory the list has a single element.

    put_TelephoneHome

    Gets and sets the list of home phone numbers of the user. In Active Directory the list has a single element.

    get_TelephoneMobile

    Gets and sets the list of mobile phone numbers of the user. In Active Directory the list has a single element.

    put_TelephoneMobile

    Gets and sets the list of mobile phone numbers of the user. In Active Directory the list has a single element.

    get_TelephoneNumber

    Gets and sets the list of work-related phone numbers. In Active Directory the list has a single element.

    put_TelephoneNumber

    Gets and sets the list of work-related phone numbers. In Active Directory the list has a single element.

    get_TelephonePager

    Gets and sets the list of pager phone numbers.

    put_TelephonePager

    Gets and sets the list of pager phone numbers.

    get_FaxNumber

    Gets and sets the list of fax phone numbers. In Active Directory the list has a single element.

    put_FaxNumber

    Gets and sets the list of fax phone numbers. In Active Directory the list has a single element.

    get_OfficeLocations

    Gets and sets the array of end-user locations. In Active Directory the array has a single element.

    put_OfficeLocations

    Gets and sets the array of end-user locations. In Active Directory the array has a single element.

    get_PostalAddresses

    Gets and sets the array of end-user post office addresses.

    put_PostalAddresses

    Gets and sets the array of end-user post office addresses.

    get_PostalCodes

    Gets and sets the array of postal codes for the Postal Addresses. In Active Directory the array has a single element.

    put_PostalCodes

    Gets and sets the array of postal codes for the Postal Addresses. In Active Directory the array has a single element.

    get_SeeAlso

    Gets and sets the array of ADsPaths of other objects related to this user.

    put_SeeAlso

    Gets and sets the array of ADsPaths of other objects related to this user.

    get_AccountDisabled

    Gets and sets the flag to indicate whether or not the account is disabled.

    put_AccountDisabled

    Gets and sets the flag to indicate whether or not the account is disabled.

    get_AccountExpirationDate

    Gets and sets the expiration date and time of the user.

    put_AccountExpirationDate

    Gets and sets the expiration date and time of the user.

    get_GraceLoginsAllowed

    Gets and sets the number of times user can log on after password has expired.

    put_GraceLoginsAllowed

    Gets and sets the number of times user can log on after password has expired.

    get_GraceLoginsRemaining

    Gets and sets the number of grace logins left before locking account.

    put_GraceLoginsRemaining

    Gets and sets the number of grace logins left before locking account.

    get_IsAccountLocked

    Gets and sets a flag to indicate whether or not an account is locked.

    put_IsAccountLocked

    Gets and sets a flag to indicate whether or not an account is locked.

    get_LoginHours

    Gets and sets the time periods during each day of week that indicate valid login periods.

    put_LoginHours

    Gets and sets the time periods during each day of week that indicate valid login periods.

    get_LoginWorkstations

    Gets and set the workstations and their net addresses for this end-user.

    put_LoginWorkstations

    Gets and set the workstations and their net addresses for this end-user.

    get_MaxLogins

    Gets and sets the maximum number of simultaneous logins.

    put_MaxLogins

    Gets and sets the maximum number of simultaneous logins.

    get_MaxStorage

    Gets and set the maximum amount of disk space allotted for the user.

    put_MaxStorage

    Gets and set the maximum amount of disk space allotted for the user.

    get_PasswordExpirationDate

    Gets and sets the date and time when password expires.

    put_PasswordExpirationDate

    Gets and sets the date and time when password expires.

    get_PasswordMinimumLength

    Gets and sets the minimum number of characters allowed in a password.

    put_PasswordMinimumLength

    Gets and sets the minimum number of characters allowed in a password.

    get_PasswordRequired

    Gets and sets a flag to indicate whether or not a password is required.

    put_PasswordRequired

    Gets and sets a flag to indicate whether or not a password is required.

    get_RequireUniquePassword

    Gets and sets a flag to indicate whether or not a new password must be different from ones in the password history list.

    put_RequireUniquePassword

    Gets and sets a flag to indicate whether or not a new password must be different from ones in the password history list.

    get_EmailAddress

    Gets and sets the e-mail address of the user.

    put_EmailAddress

    Gets and sets the e-mail address of the user.

    get_HomeDirectory

    Gets and sets the home directory of the user.

    put_HomeDirectory

    Gets and sets the home directory of the user.

    get_Languages

    Gets and sets the array of language names for the end-user.

    put_Languages

    Gets and sets the array of language names for the end-user.

    get_Profile

    Gets and sets the end-user's profile path.

    put_Profile

    Gets and sets the end-user's profile path.

    get_LoginScript

    Gets and sets the end-user's login script path.

    put_LoginScript

    Gets and sets the end-user's login script path.

    get_Picture

    Gets and sets the picture of the user.

    put_Picture

    Gets and sets the picture of the user.

    get_HomePage

    Gets and sets the URL to the home page of the user.

    put_HomePage

    Gets and sets the URL to the home page of the user.

    Groups

    Determines the groups to which this end-user belongs.

    SetPassword

    Sets the password.

    ChangePassword

    Changes password from the specified existing value to a new value.

     

    Friday, September 25, 2009 11:56 AM