Please excuse the double post if your reader shows this
as a new and as a reply. I can only use the web interface
and it puts my reply 34 pages in.
I am getting an error while trying to do a LDAP lookup
using the DirectoryEntry Object. What is caught is:
System.Runtime.InteropServices.COMException (0x80004005):
Error HRESULT has been returned from a call to a COM
component.
The error without the try..catch is
System.Runtime.InteropServices.COMException: Unknown
error (0x80005000)
related to my
// Do the search
foreach(SearchResult result in DirSearcher.FindAll())
code.
When I explicitly specify the DirectoryEntry parameters
it works fine, when I try to use a variable (LDAPQuery)
it fails. The string is being created properly as I can
assign it to a label and have it output correctly.
Any clues?
Code:
LDAPQuery = string.Format("\"LDAP://{0}\", \"{1}\", \"{2}
\"", domain, UsrName, UsrPass);
// This does not work
DirectoryEntry SearchRoot = new DirectoryEntry(LDAPQuery);
// This works
// DirectoryEntry SearchRoot = new DirectoryEntry
("LDAP://testdomain", "fubarjones", "Testing@9");
Jay 2 6826
DirectoryEntry takes 3 arguments, not a single string!
Change your code like this:
string LDAPQuery = string.Format("LDAP://{0}", domain);
DirectoryEntry SearchRoot = new DirectoryEntry(LDAPQuery, UsrName, UsrPass);
Willy.
"Jay" <an*******@discussions.microsoft.com> wrote in message
news:50****************************@phx.gbl... Please excuse the double post if your reader shows this as a new and as a reply. I can only use the web interface and it puts my reply 34 pages in.
I am getting an error while trying to do a LDAP lookup using the DirectoryEntry Object. What is caught is:
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT has been returned from a call to a COM component.
The error without the try..catch is
System.Runtime.InteropServices.COMException: Unknown error (0x80005000)
related to my
// Do the search foreach(SearchResult result in DirSearcher.FindAll())
code.
When I explicitly specify the DirectoryEntry parameters it works fine, when I try to use a variable (LDAPQuery) it fails. The string is being created properly as I can assign it to a label and have it output correctly.
Any clues?
Code:
LDAPQuery = string.Format("\"LDAP://{0}\", \"{1}\", \"{2} \"", domain, UsrName, UsrPass);
// This does not work DirectoryEntry SearchRoot = new DirectoryEntry(LDAPQuery);
// This works // DirectoryEntry SearchRoot = new DirectoryEntry ("LDAP://testdomain", "fubarjones", "Testing@9");
Jay
Thanks, that fixed it.
Jay -----Original Message----- DirectoryEntry takes 3 arguments, not a single string!
Change your code like this:
string LDAPQuery = string.Format("LDAP://{0}", domain); DirectoryEntry SearchRoot = new DirectoryEntry
(LDAPQuery, UsrName, UsrPass); Willy.
"Jay" <an*******@discussions.microsoft.com> wrote in
messagenews:50****************************@phx.gbl... Please excuse the double post if your reader shows this as a new and as a reply. I can only use the web
interface and it puts my reply 34 pages in.
I am getting an error while trying to do a LDAP lookup using the DirectoryEntry Object. What is caught is:
System.Runtime.InteropServices.COMException
(0x80004005): Error HRESULT has been returned from a call to a COM component.
The error without the try..catch is
System.Runtime.InteropServices.COMException: Unknown error (0x80005000)
related to my
// Do the search foreach(SearchResult result in DirSearcher.FindAll())
code.
When I explicitly specify the DirectoryEntry parameters it works fine, when I try to use a variable (LDAPQuery) it fails. The string is being created properly as I can assign it to a label and have it output correctly.
Any clues?
Code:
LDAPQuery = string.Format("\"LDAP://{0}\", \"{1}\",
\"{2} \"", domain, UsrName, UsrPass);
// This does not work DirectoryEntry SearchRoot = new DirectoryEntry
(LDAPQuery); // This works // DirectoryEntry SearchRoot = new DirectoryEntry ("LDAP://testdomain", "fubarjones", "Testing@9");
Jay
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: joshc |
last post by:
If I have an array of data that I know to be sorted in increasing
order, and the array is less than 50 elements, and I want to find the
first element greater than a certain value, is a simple...
|
by: Jessica |
last post by:
When I create a single LDAP ActiveDirectory user and use
DirectoryEntry.Invoke("SetPassword"...), the user is created and the
password is set with no problems.
However, when I try to add more...
|
by: Jessica |
last post by:
I have a .Net 1.0 web service that uses a .Net 1.1 assembly to create
users, change users' passwords, validate users, and remove users from
an LDAP server. The 1.1 code uses the DirectoryServices...
|
by: AbdSol |
last post by:
I wanted to know why the output is different & also like to know if C# i can
get the user name using DirectoryEntry > find.
C#
String myADSPath = ("WinNT://"+...
|
by: kenguil |
last post by:
I'm hoping that this is the right group to post this to and that
someone will have an answer to this.
Environment:
1) Laptop joined to domain "foo.com", logged in using cached
credentials
2)...
|
by: Chad Beckner |
last post by:
Hi everyone,
Sorry for cross posting, but I wanted to try and put this where it would
be more visible to everyone... :-)
I need to find a way to be able to search for entries in our ADS tree. ...
|
by: huzz |
last post by:
How do i create a directory entry to access a user's details such as their
email address. Here are the object structure.
domain.co.uk
|
|Computer Services - Type (OU)
|
|Cliff Saran - Type...
|
by: Ed Morrison |
last post by:
I am trying to change the userPassword property of an Active Directory user
account, but it does not work. I do not receive an error. The new password
is not valid, but the old password still...
|
by: Drew Burchett |
last post by:
I am working with Active Directory in C# and trying to read and set certain
attributes. To set an attribute, I have the following code:
DirectoryEntry de = new DirectoryEntry(); //This is...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |