Re: Error setting DirecotrySearcher's new ExtendedDN
- From: "Joe Kaplan \(MVP - ADSI\)" <joseph.e.kaplan@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 13 Aug 2006 20:48:49 -0500
Unfortunately, the .NET docs are wrong. This is documented, but you have to
really dig to know where to find it.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/ads_searchpref_enum.asp?frame=true
Those are the search pref flags for IDirectorySearch, which is the COM
interface that the DirectorySearcher actually uses under the hood.
We also cover this in our book in ch 5. It might help you out a bit. :)
Joe K.
--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
"Pucca" <Pucca@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:90D33641-BA19-4A29-95AE-F0F664654ED7@xxxxxxxxxxxxxxxx
Thanks Joe, but now I'm worried and confused. At the link, the platforms
supports Win 2000 sp4, which is the lowest MS OS that I need to support.
Did
I mis-understand what the platform on this web site stands for? (Oh,
sorry,
I forgot to post the exception message)
http://msdn2.microsoft.com/en-us/library/system.directoryservices.directorysearcher.extendeddn.aspx
--------------------------------
Platforms
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server
2003, Windows XP Media Center Edition, Windows XP Professional x64
Edition,
Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a
list of the supported versions, see System Requirements.
--
Thanks.
"Joe Kaplan (MVP - ADSI)" wrote:
ExtendedDN only works on Windows 2003 machines and higher. It doesn't
work
on XP (if yo are using it via ADSI, which S.DS does). Is your machine XP
or
lower?
BTW, you didn't show the exception...
Joe K.
--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services
Programming"
http://www.directoryprogramming.net
--
"Pucca" <Pucca@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:84B87E31-7443-41E2-862E-30D0757092AB@xxxxxxxxxxxxxxxx
Hi, I'm developeing with VS2005 and .Net 2.0 and C#. I'm trying to set
the
DirecotrySearcher's new ExtendedDN property but I keep getting the
following
error when my code reaches "using (SearchResultCollection results =
srch.FindAll())". I don't get any error at the code of setting the
prooperty
though, "srch.ExtendedDN = ExtendedDN.Standard;" Can anyone see what I
need
to correct here? Thanks.
public string GetWinName(DirectoryEntry de, DirectoryEntry
deParent)
{
string sidKey = null, childSidKey = null, sid = null;
int lastDash = 0;
childSidKey = de.Properties["cn"].Value.ToString();
de.AuthenticationType = AuthenticationTypes.FastBind |
AuthenticationTypes.Secure;
DirectorySearcher srch = new DirectorySearcher(deParent);
srch.SearchScope = SearchScope.OneLevel;
srch.Filter = ("(objectClass=meeting)");
srch.PropertiesToLoad.Add("distinguishedName");
/* Instruct the DirectorySearcher to use the
* new ExtendedDN enumeration to return either
* the standard format or hex format for the
* distinguishedName. In this case, dnFormat
* is a ExtendedDN type parameter passed into
* the function.
*/
srch.ExtendedDN = ExtendedDN.Standard;
using (SearchResultCollection results = srch.FindAll())
{
foreach (SearchResult res in results)
{
String extDn =
res.Properties["distinguishedName"][0].ToString();
String[] dnParts = extDn.Split(new char[] { ';' });
--
Thanks.
.
- Follow-Ups:
- References:
- Re: Error setting DirecotrySearcher's new ExtendedDN
- From: Joe Kaplan \(MVP - ADSI\)
- Re: Error setting DirecotrySearcher's new ExtendedDN
- From: Pucca
- Re: Error setting DirecotrySearcher's new ExtendedDN
- Prev by Date: Re: Need help getting the domain SID when given a DC=XXX,DC=YYY,CD
- Next by Date: RE: InitializeSecurityContext() and Digest in C++
- Previous by thread: Re: Error setting DirecotrySearcher's new ExtendedDN
- Next by thread: Re: Error setting DirecotrySearcher's new ExtendedDN
- Index(es):
Relevant Pages
|