The text of this article is not in this database — only its details are. The old site it was published on is gone, but the Internet Archive kept a copy: Integrating LDAP Active Directory into your .Net Web Portal (C# or VB.NET)
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.
Sonu ChaudharyPosted Feb 25, 2016, 6:38 AM
good one!
Santhakumar MunuswamyPosted Sep 27, 2015, 3:13 AM
good Article
shrikant kesharwaniPosted Dec 28, 2011, 4:20 PM
Hi All I am using windows 2008 R2 Server and trying to Add a user in active directory . I am able to save user ID of length less than 20 Characters.But when I am trying to increase this value to 30 characters then I am getting the error. “System.DirectoryServices.DirectoryServicesCOMException (0x8007001F): A device attached to the system is not functioning. (Exception from HRESULT: 0x8007001F)” This error when I searched on net give me various links saying that: (a) Please verify if the issue is caused by the length of sAMAccountName (b) The document of SAM-Account-Name also indicates that the length of it should be less than 20 characters. I am using the code below to add user in Active Directory public static void AddUser(ADUser adUser) { if (_logger.IsDebugEnabled) _logger.Debug("ADHelper.cs: Enter AddUser"); // Local variables DirectoryEntry oDE = null; DirectoryEntry oDENewUser = null; DirectoryEntries oDEs = null; try { oDE = GetDirectoryEntry(GetADPath(adUser.UserType)); // 1. Create user account oDEs = oDE.Children; oDENewUser = oDEs.Add("CN=" + adUser.UserName, "user"); // 2. Set properties SetProperty(oDENewUser, Constants.ADAttributes.givenName, adUser.FirstName); SetProperty(oDENewUser, Constants.ADAttributes.initials, adUser.MiddleInitial); SetProperty(oDENewUser, Constants.ADAttributes.sn, adUser.LastName); SetProperty(oDENewUser, Constants.ADAttributes.mail, adUser.Email); SetProperty(oDENewUser, Constants.ADAttributes.sAMAccountName, adUser.UserName); SetProperty(oDENewUser, Constants.ADAttributes.ChallengeQuestion, adUser.PasswordChallengeQuestion); SetProperty(oDENewUser, Constants.ADAttributes.ChallengeAnswer, adUser.PasswordChallengeAnswer); SetProperty(oDENewUser, Constants.ADAttributes.ChallengeQuestion2, adUser.PasswordChallengeQuestion2); SetProperty(oDENewUser, Constants.ADAttributes.ChallengeAnswer2, adUser.PasswordChallengeAnswer2); // Sharepoint changes if (adUser.CompanyGroupSupplier != string.Empty) { SetProperty(oDENewUser, Constants.ADAttributes.CompanyGroupSupplier, adUser.CompanyGroupSupplier); } if (adUser.PersonalGroupAddress != string.Empty) { SetProperty(oDENewUser, Constants.ADAttributes.PersonalGroupAddress, adUser.PersonalGroupAddress); } if (adUser.PersonalGroupPhone != string.Empty) { SetProperty(oDENewUser, Constants.ADAttributes.PersonalGroupPhone, adUser.PersonalGroupPhone); } // Sharepoint changes oDENewUser.CommitChanges(); // 3. Set password SetPassword(oDENewUser.Path, adUser.Password); // 4. Enable account EnableAccount(oDENewUser); oDENewUser.Close(); oDE.Close(); if (_logger.IsDebugEnabled) _logger.Debug("ADHelper.cs: Exit AddUser"); } catch (ApplicationException appex) { if (_logger.IsErrorEnabled) _logger.Error("ADHelper.cs: Exception occurred in AddUser. Message: ", appex); throw appex; } catch (Exception ex) { if (_logger.IsErrorEnabled) _logger.Error("ADHelper.cs: Exception occurred in AddUser. Message: ", ex); throw ex; } finally { if (oDENewUser != null) { oDENewUser.Dispose(); oDENewUser = null; } if (oDEs != null) { oDEs = null; } if (oDE != null) { oDE.Dispose(); oDE = null; } } } Please any one can suggest me how can increase sAMAccountName length in Active Directory around 30 characters in length. Thanks in Advance
Amreesh SharmaeditedPosted Apr 15, 2009, 2:58 AMEdited Apr 15, 2009, 10:23 AM
Plz elaborate in SharePoint Perspective.....how best it can be used
Kevin RouPosted Mar 6, 2009, 1:13 AM
The article seems to be missing the download link: http://www.dotnetactivedirectory.com. sorry about that.