Answered by:
directoryentry

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
-
the method name is the method in your class you wish to invoke (the delegate method)
Saturday, August 19, 2006 12:53 PM -
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).aspxMethod Description Gets the object's relative name.
Gets the name of the object's schema class.
Gets the GUID of the object as stored in the underlying directory store.
Gets the object's ADsPath that uniquely identifies this object from all others.
Gets the ADsPath string for the parent of the object.
Gets the ADsPath string to the schema class object for this object.
Loads the property values of this object from the underlying directory store.
Persists the changes on this object to the underlying directory store.
Gets the value for a property by name.
Sets the value for a property by name.
Gets the value for a single or multi-valued property by name.
Sets the value for a single or multi-valued property by name.
Loads specific property values of this object from the underlying directory store.
Gets the address of the last node, considered an "Intruder".
Gets the number of the bad logon attempts since last reset.
Gets the date and time of the last network login.
Gets the date and time of the last network logoff.
Gets the date and time of the last failed network login.
Gets the date and time of the last password change.
Gets and sets the description of the user account.
Gets and sets the description of the user account.
Gets and sets the division within a company (organization).
Gets and sets the division within a company (organization).
Gets and sets the organizational unit within the organization.
Gets and sets the organizational unit within the organization.
Gets and sets employee identification number of the user.
Gets and sets employee identification number of the user.
Gets and sets the full name of the user.
Gets and sets the full name of the user.
Gets and sets the first name of the user.
Gets and sets the first name of the user.
Gets and sets the last name of the user.
Gets and sets the last name of the user.
Gets and sets the additional name, such as the nickname, or the middle name of the user.
Gets and sets the additional name, such as the nickname, or the middle name of the user.
Gets and sets the name prefix, such as Mr., Ms., or Hon., of the user.
Gets and sets the name prefix, such as Mr., Ms., or Hon., of the user.
Gets and sets the name suffix, such as Jr. or III, of the user.
Gets and sets the name suffix, such as Jr. or III, of the user.
Gets and sets the user's title within the organization.
Gets and sets the user's title within the organization.
Gets and sets the manager of the user.
Gets and sets the manager of the user.
Gets and sets the list of home phone numbers of the user. In Active Directory the list has a single element.
Gets and sets the list of home phone numbers of the user. In Active Directory the list has a single element.
Gets and sets the list of mobile phone numbers of the user. In Active Directory the list has a single element.
Gets and sets the list of mobile phone numbers of the user. In Active Directory the list has a single element.
Gets and sets the list of work-related phone numbers. In Active Directory the list has a single element.
Gets and sets the list of work-related phone numbers. In Active Directory the list has a single element.
Gets and sets the list of pager phone numbers.
Gets and sets the list of pager phone numbers.
Gets and sets the list of fax phone numbers. In Active Directory the list has a single element.
Gets and sets the list of fax phone numbers. In Active Directory the list has a single element.
Gets and sets the array of end-user locations. In Active Directory the array has a single element.
Gets and sets the array of end-user locations. In Active Directory the array has a single element.
Gets and sets the array of end-user post office addresses.
Gets and sets the array of end-user post office addresses.
Gets and sets the array of postal codes for the Postal Addresses. In Active Directory the array has a single element.
Gets and sets the array of postal codes for the Postal Addresses. In Active Directory the array has a single element.
Gets and sets the array of ADsPaths of other objects related to this user.
Gets and sets the array of ADsPaths of other objects related to this user.
Gets and sets the flag to indicate whether or not the account is disabled.
Gets and sets the flag to indicate whether or not the account is disabled.
Gets and sets the expiration date and time of the user.
Gets and sets the expiration date and time of the user.
Gets and sets the number of times user can log on after password has expired.
Gets and sets the number of times user can log on after password has expired.
Gets and sets the number of grace logins left before locking account.
Gets and sets the number of grace logins left before locking account.
Gets and sets a flag to indicate whether or not an account is locked.
Gets and sets a flag to indicate whether or not an account is locked.
Gets and sets the time periods during each day of week that indicate valid login periods.
Gets and sets the time periods during each day of week that indicate valid login periods.
Gets and set the workstations and their net addresses for this end-user.
Gets and set the workstations and their net addresses for this end-user.
Gets and sets the maximum number of simultaneous logins.
Gets and sets the maximum number of simultaneous logins.
Gets and set the maximum amount of disk space allotted for the user.
Gets and set the maximum amount of disk space allotted for the user.
Gets and sets the date and time when password expires.
Gets and sets the date and time when password expires.
Gets and sets the minimum number of characters allowed in a password.
Gets and sets the minimum number of characters allowed in a password.
Gets and sets a flag to indicate whether or not a password is required.
Gets and sets a flag to indicate whether or not a password is required.
Gets and sets a flag to indicate whether or not a new password must be different from ones in the password history list.
Gets and sets a flag to indicate whether or not a new password must be different from ones in the password history list.
Gets and sets the e-mail address of the user.
Gets and sets the e-mail address of the user.
Gets and sets the home directory of the user.
Gets and sets the home directory of the user.
Gets and sets the array of language names for the end-user.
Gets and sets the array of language names for the end-user.
Gets and sets the end-user's profile path.
Gets and sets the end-user's profile path.
Gets and sets the end-user's login script path.
Gets and sets the end-user's login script path.
Gets and sets the picture of the user.
Gets and sets the picture of the user.
Gets and sets the URL to the home page of the user.
Gets and sets the URL to the home page of the user.
Determines the groups to which this end-user belongs.
Sets the password.
Changes password from the specified existing value to a new value.
- Proposed as answer by ColourInteligent Thursday, October 8, 2009 5:33 AM
Friday, September 25, 2009 11:56 AM