Click here to Skip to main content
15,905,419 members
Home / Discussions / C#
   

C#

 
QuestionHow to set a files date modified property? Pin
gunner_uk200024-Feb-08 4:09
gunner_uk200024-Feb-08 4:09 
AnswerRe: How to set a files date modified property? Pin
Luc Pattyn24-Feb-08 4:47
sitebuilderLuc Pattyn24-Feb-08 4:47 
GeneralGDI+ Problem GUI Graphics Pin
aa1124-Feb-08 3:50
aa1124-Feb-08 3:50 
GeneralRe: GDI+ Problem GUI Graphics Pin
Ed.Poore24-Feb-08 7:14
Ed.Poore24-Feb-08 7:14 
GeneralRe: GDI+ Problem GUI Graphics Pin
Roger Alsing24-Feb-08 10:05
Roger Alsing24-Feb-08 10:05 
GeneralRe: GDI+ Problem GUI Graphics Pin
Ed.Poore24-Feb-08 15:22
Ed.Poore24-Feb-08 15:22 
GeneralRe: GDI+ Problem GUI Graphics Pin
aa2224-Feb-08 22:51
aa2224-Feb-08 22:51 
General"There is no such object on the server" Error after Active Directory SetPasword call Pin
Hesham Amin24-Feb-08 2:53
Hesham Amin24-Feb-08 2:53 
Hello
I use this code to create users in active directory, and set their passwords:

static void Main(string[] args)<br />
{<br />
	DirectoryEntry parent = new DirectoryEntry("LDAP://test/OU=Admins,DC=test,DC=org");<br />
	Console.WriteLine("OU: "+parent.Name);<br />
	Console.WriteLine("Domain name:" + System.DirectoryServices.ActiveDirectory.Domain.GetCurrentDomain().Name);<br />
	string test = "testuser";<br />
	for (int i = 0; i < 20; i++)<br />
	{<br />
		try<br />
		{<br />
			DirectoryEntry child = parent.Children.Add("CN=" + test + i.ToString(), "User");<br />
			Console.WriteLine(test + i.ToString() + ": create object");<br />
			child.Properties["name"].Value = test + i.ToString();<br />
			child.Properties["displayName"].Value = test + i.ToString();<br />
			//child.Properties["userPrincipalName"].Value = test + i.ToString() + "@" + System.DirectoryServices.ActiveDirectory.Domain.GetCurrentDomain().Name;<br />
			child.Properties["GivenName"].Value = test + i.ToString();<br />
			child.Properties["Initials"].Value = "q";<br />
			child.Properties["sn"].Value = test + i.ToString();<br />
			child.Properties["sAMAccountName"].Value = test + i.ToString();<br />
			child.CommitChanges();<br />
			Console.WriteLine(test + i.ToString() + ": commit info");<br />
			child.Invoke("SetPassword", new object[] { "!qwe@ASD" });<br />
			child.CommitChanges();<br />
			Console.WriteLine(test + i.ToString() + ": commit passowrd");<br />
		}<br />
		catch (Exception ex)<br />
		{<br />
			Console.WriteLine(test + i.ToString() + ":"+ ex.ToString());<br />
		}<br />
	}<br />
}

Within the loop, some users are created and their passwords set successfully, and randomly setting password for some users fail with this error:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DirectoryServices.DirectoryServicesCOMException (0x80072030): There is no such object on the server. (Exception from HRESULT: 0x80072030)
--- End of inner exception stack trace ---
at System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args)


What are the possible causes for this error? and what are the workarounds?

Hesham A. Amin
My blog

GeneralRe: "There is no such object on the server" Error after Active Directory SetPasword call Pin
foluis29-Mar-10 6:52
foluis29-Mar-10 6:52 
GeneralRe: "There is no such object on the server" Error after Active Directory SetPasword call Pin
Hesham Amin3-Apr-10 23:55
Hesham Amin3-Apr-10 23:55 
Questionhow to attach picture to database ? Pin
E_Gold24-Feb-08 0:39
E_Gold24-Feb-08 0:39 
AnswerRe: how to attach picture to database ? Pin
Giorgi Dalakishvili24-Feb-08 1:04
mentorGiorgi Dalakishvili24-Feb-08 1:04 
QuestionVS2003 projects will not open ? Pin
Christian Graus23-Feb-08 23:57
protectorChristian Graus23-Feb-08 23:57 
AnswerRe: VS2003 projects will not open ? Pin
Ed.Poore24-Feb-08 7:15
Ed.Poore24-Feb-08 7:15 
GeneralRe: VS2003 projects will not open ? Pin
Christian Graus24-Feb-08 12:11
protectorChristian Graus24-Feb-08 12:11 
GeneralRe: VS2003 projects will not open ? Pin
Ed.Poore24-Feb-08 12:21
Ed.Poore24-Feb-08 12:21 
GeneralRe: VS2003 projects will not open ? Pin
Christian Graus24-Feb-08 13:05
protectorChristian Graus24-Feb-08 13:05 
GeneralRe: VS2003 projects will not open ? Pin
Ed.Poore24-Feb-08 15:23
Ed.Poore24-Feb-08 15:23 
GeneralPopulate TreeView node by clicking item in ListView Pin
MrColeyted23-Feb-08 20:07
MrColeyted23-Feb-08 20:07 
GeneralRe: Populate TreeView node by clicking item in ListView Pin
Gareth H23-Feb-08 23:14
Gareth H23-Feb-08 23:14 
GeneralRe: Populate TreeView node by clicking item in ListView Pin
MrColeyted24-Feb-08 12:06
MrColeyted24-Feb-08 12:06 
Generalcustom user control Pin
seta_yas23-Feb-08 19:47
seta_yas23-Feb-08 19:47 
QuestionC# Passings Socket references between systems Pin
FASERVER23-Feb-08 15:19
FASERVER23-Feb-08 15:19 
GeneralRe: C# Passings Socket references between systems Pin
Ed.Poore24-Feb-08 7:09
Ed.Poore24-Feb-08 7:09 
GeneralRe: C# Passings Socket references between systems Pin
FASERVER24-Feb-08 14:06
FASERVER24-Feb-08 14:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.