directoryentry

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



Answer this question

directoryentry

  • Ronald S.

    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...



  • DaveRogers

    Try:
    obj.Invoke("ChangePassword", "", "NewPassword")

    Is this stuff working I couldn't try it out myself...


  • davidacoder

    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..........


  • Ramachandran V

    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..............


  • Nonu_k

    thanks all


  • Salman Maredia

    Hello,

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

    thanks

    thaya



  • vaddi

    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


  • .NET_Developer

  • NickHHH

    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


  • Spider

    yes Nobugz I was thinking about that but more specifically invoking a method. :-) Thanks for clearing that up!

  • blobz

    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.


  • Grumpy McNasty

    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


  • directoryentry