Re: [ActiveDir] "A referral was returned from the server" when ex ecuting a query.

2005-02-28 Thread Mikael Håkansson
Ok, thanks.

I will check this immediately :)

Mikael

On Mon, 28 Feb 2005 10:25:50 -0500, Mulnick, Al <[EMAIL PROTECTED]> wrote:
> I would expect the error to occur in the part of the code that makes the
> search request.  src = dsDirSearcher.FindAll()
> 
> The referral may be occurring because of a multi-domain environment.  You're
> making a call to the directory looking for objects that exist in one domain
> while the string you are using to connect may be the root domain instead.
> 
> You can debug that by writing out your variables and strings to see what the
> exact query string is (I like to write out the query string exactly as it's
> called to make sure I'm not making a syntax error).  When you posted here,
> you cleaned it up, but look again to make sure that the domain you're trying
> to query against is the domain your app lives in.  This one m_sRootDomain
> would be an interesting string/var to know the value of at runtime.
> 
> As Joe mentioned, the GC is likely a better bet to use since you won't have
> to worry about domain location as much.  The GAL is made up of attributes
> that are in the GC since it needs to be global anyway.  Microsoft put the
> GAL attributes into the GC so you can find all users globally in a forest
> and that is presented back to you as an Address List. You can find out
> exactly which attributes get put there from MDSN and looking at the Exchange
> attributes.
> 
> 
> Al
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Mikael Håkansson
> Sent: Monday, February 28, 2005 10:14 AM
> To: ActiveDir@mail.activedir.org
> Subject: Re: [ActiveDir] "A referral was returned from the server" when ex
> ecuting a query.
> 
> Well, this is the problem... I don´t really know.
> This module is a part of a bigger application, and the error occurs on one
> of the customers networks. I assume there exists several forests since it´s
> a big company (world-wide). Unfortunately, I can´t run any test with e.g.
> LDP since they do not allow any test on their "live"
> environment. I was hoping that someone might have any idea what could cause
> a problem like this.
> 
> Code snippet:
> dim de as new directoryEntry("LDAP://"; & m_sRootDomain) dim dsDirSearcher as
> new DirectorySearcher(de) dim src as SearchResultCollection
> 
> dsDirSearcher.Filter = m_AddressBook.Filter dsDirSearcher.SizeLimit =
> Options.MaxHits dsDirSearcher.PropertiesToLoad = m_arrProperties
> dsDirSearcher.ReferralChasing = ReferralChasingOption.All
> dsDirSearcher.SearchScope = SearchScope.Subtree dsDirSearcher.CacheResults =
> True
> 
> src = dsDirSearcher.FindAll()  <  boom, this is where it all goes to
> h***
> 
> Regarding Joe´s post about GC.
> Which attributes are stored in the GC? I need to retrieve information like
> phone numbers, name, address, mail etc.
> 
> This are the attributes I´m interested in:
> givenName,sn,title,mail,company,department,info,whenChanged,physicalDelivery
> OfficeName,whenCreated,userPrincipalName,targetaddress,Street,l,postalCode,c
> ,st,telephoneNumber,facsimileTelephoneNumber,otherFacsimileTelephoneNumber,h
> omePhone,otherHomePhone,mobile,otherMobile,otherTelephone,distinguishedname
> 
> Mikael
> 
> On Mon, 28 Feb 2005 09:52:08 -0500, joe <[EMAIL PROTECTED]> wrote:
> > Hopefully JoeK will swing by shortly to say his piece on the NET call.
> >
> > For the queries below, unless you want them scoped at a specific
> > domain anyway, consider querying a GC since all of those attribs are in
> the GC.
> >
> >  joe
> >
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Mulnick, Al
> > Sent: Monday, February 28, 2005 9:19 AM
> > To: ActiveDir@mail.activedir.org
> > Subject: RE: [ActiveDir] "A referral was returned from the server"
> > when ex ecuting a query.
> >
> > Can you include the code snippet where this occurs?
> >
> > Have you tried using an alternate tool (LDP or Joe's ADFIND) to
> > validate that you don't get the same results from those tools?
> >
> > ??Is this a single domain forest that you're testing in?
> >
> > Al
> >
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Mikael
> > Håkansson
> > Sent: Monday, February 28, 2005 9:06 AM
> > To: ActiveDir@mail.activedir.org
> > Subject: Re: [ActiveDir] "A referral was returned from the server"
> > when executing a query.
> >
> > Any query throws the referral exc

RE: [ActiveDir] "A referral was returned from the server" when ex ecuting a query.

2005-02-28 Thread Mulnick, Al
I would expect the error to occur in the part of the code that makes the
search request.  src = dsDirSearcher.FindAll()

The referral may be occurring because of a multi-domain environment.  You're
making a call to the directory looking for objects that exist in one domain
while the string you are using to connect may be the root domain instead.  

You can debug that by writing out your variables and strings to see what the
exact query string is (I like to write out the query string exactly as it's
called to make sure I'm not making a syntax error).  When you posted here,
you cleaned it up, but look again to make sure that the domain you're trying
to query against is the domain your app lives in.  This one m_sRootDomain
would be an interesting string/var to know the value of at runtime.  

As Joe mentioned, the GC is likely a better bet to use since you won't have
to worry about domain location as much.  The GAL is made up of attributes
that are in the GC since it needs to be global anyway.  Microsoft put the
GAL attributes into the GC so you can find all users globally in a forest
and that is presented back to you as an Address List. You can find out
exactly which attributes get put there from MDSN and looking at the Exchange
attributes. 


Al 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mikael Håkansson
Sent: Monday, February 28, 2005 10:14 AM
To: ActiveDir@mail.activedir.org
Subject: Re: [ActiveDir] "A referral was returned from the server" when ex
ecuting a query.

Well, this is the problem... I don´t really know.
This module is a part of a bigger application, and the error occurs on one
of the customers networks. I assume there exists several forests since it´s
a big company (world-wide). Unfortunately, I can´t run any test with e.g.
LDP since they do not allow any test on their "live"
environment. I was hoping that someone might have any idea what could cause
a problem like this.

Code snippet:
dim de as new directoryEntry("LDAP://"; & m_sRootDomain) dim dsDirSearcher as
new DirectorySearcher(de) dim src as SearchResultCollection

dsDirSearcher.Filter = m_AddressBook.Filter dsDirSearcher.SizeLimit =
Options.MaxHits dsDirSearcher.PropertiesToLoad = m_arrProperties
dsDirSearcher.ReferralChasing = ReferralChasingOption.All
dsDirSearcher.SearchScope = SearchScope.Subtree dsDirSearcher.CacheResults =
True

src = dsDirSearcher.FindAll()  <  boom, this is where it all goes to
h***

Regarding Joe´s post about GC.
Which attributes are stored in the GC? I need to retrieve information like
phone numbers, name, address, mail etc.

This are the attributes I´m interested in:
givenName,sn,title,mail,company,department,info,whenChanged,physicalDelivery
OfficeName,whenCreated,userPrincipalName,targetaddress,Street,l,postalCode,c
,st,telephoneNumber,facsimileTelephoneNumber,otherFacsimileTelephoneNumber,h
omePhone,otherHomePhone,mobile,otherMobile,otherTelephone,distinguishedname

Mikael

On Mon, 28 Feb 2005 09:52:08 -0500, joe <[EMAIL PROTECTED]> wrote:
> Hopefully JoeK will swing by shortly to say his piece on the NET call.
> 
> For the queries below, unless you want them scoped at a specific 
> domain anyway, consider querying a GC since all of those attribs are in
the GC.
> 
>  joe
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Mulnick, Al
> Sent: Monday, February 28, 2005 9:19 AM
> To: ActiveDir@mail.activedir.org
> Subject: RE: [ActiveDir] "A referral was returned from the server" 
> when ex ecuting a query.
> 
> Can you include the code snippet where this occurs?
> 
> Have you tried using an alternate tool (LDP or Joe's ADFIND) to 
> validate that you don't get the same results from those tools?
> 
> ??Is this a single domain forest that you're testing in?
> 
> Al
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Mikael 
> Håkansson
> Sent: Monday, February 28, 2005 9:06 AM
> To: ActiveDir@mail.activedir.org
> Subject: Re: [ActiveDir] "A referral was returned from the server" 
> when executing a query.
> 
> Any query throws the referral exception.
> 
> Like
> 
> "(& (mailnickname=*) (|
> (&(objectCategory=person)(objectClass=contact)) ))" which is from the 
> "All Contacts" address list.
> 
> or
> 
> "(& (mailnickname=*) (|
> (&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHome
> Server 
> Name=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msEx
> chHome 
> ServerName=*)))(&(objectCategory=person)(objectClass=contact))(objectC
> ategor 
> y=group)(objectCategory=publicFolder)(objectCategory=msExchDynamicDist
> ributi
> 

Re: [ActiveDir] "A referral was returned from the server" when ex ecuting a query.

2005-02-28 Thread Mikael Håkansson
Well, this is the problem... I don´t really know.
This module is a part of a bigger application, and the error occurs on
one of the customers networks. I assume there exists several forests
since it´s a big company (world-wide). Unfortunately, I can´t run any
test with e.g. LDP since they do not allow any test on their "live"
environment. I was hoping that someone might have any idea what could
cause a problem like this.

Code snippet:
dim de as new directoryEntry("LDAP://"; & m_sRootDomain)
dim dsDirSearcher as new DirectorySearcher(de)
dim src as SearchResultCollection

dsDirSearcher.Filter = m_AddressBook.Filter
dsDirSearcher.SizeLimit = Options.MaxHits
dsDirSearcher.PropertiesToLoad = m_arrProperties
dsDirSearcher.ReferralChasing = ReferralChasingOption.All
dsDirSearcher.SearchScope = SearchScope.Subtree
dsDirSearcher.CacheResults = True

src = dsDirSearcher.FindAll()  <  boom, this is where it all goes to h***

Regarding Joe´s post about GC.
Which attributes are stored in the GC? I need to retrieve information
like phone numbers, name, address, mail etc.

This are the attributes I´m interested in:
givenName,sn,title,mail,company,department,info,whenChanged,physicalDeliveryOfficeName,whenCreated,userPrincipalName,targetaddress,Street,l,postalCode,c,st,telephoneNumber,facsimileTelephoneNumber,otherFacsimileTelephoneNumber,homePhone,otherHomePhone,mobile,otherMobile,otherTelephone,distinguishedname

Mikael

On Mon, 28 Feb 2005 09:52:08 -0500, joe <[EMAIL PROTECTED]> wrote:
> Hopefully JoeK will swing by shortly to say his piece on the NET call.
> 
> For the queries below, unless you want them scoped at a specific domain
> anyway, consider querying a GC since all of those attribs are in the GC.
> 
>  joe
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Mulnick, Al
> Sent: Monday, February 28, 2005 9:19 AM
> To: ActiveDir@mail.activedir.org
> Subject: RE: [ActiveDir] "A referral was returned from the server" when ex
> ecuting a query.
> 
> Can you include the code snippet where this occurs?
> 
> Have you tried using an alternate tool (LDP or Joe's ADFIND) to validate
> that you don't get the same results from those tools?
> 
> ??Is this a single domain forest that you're testing in?
> 
> Al
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Mikael Håkansson
> Sent: Monday, February 28, 2005 9:06 AM
> To: ActiveDir@mail.activedir.org
> Subject: Re: [ActiveDir] "A referral was returned from the server" when
> executing a query.
> 
> Any query throws the referral exception.
> 
> Like
> 
> "(& (mailnickname=*) (|
> (&(objectCategory=person)(objectClass=contact)) ))" which is from the "All
> Contacts" address list.
> 
> or
> 
> "(& (mailnickname=*) (|
> (&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServer
> Name=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHome
> ServerName=*)))(&(objectCategory=person)(objectClass=contact))(objectCategor
> y=group)(objectCategory=publicFolder)(objectCategory=msExchDynamicDistributi
> onList)
> ))"
> whis is from the Default Global Address list.
> 
> Any ideas are welcome =)
> 
> Mikael Håkansson
> 
> On Mon, 28 Feb 2005 08:50:43 -0500, joe <[EMAIL PROTECTED]> wrote:
> > 1. Cool
> >
> > 2. Your search should use objectcategory, not objectclass.
> >
> > 3a. Ok
> >
> > 3b. What exactly is the query? The rest of the stuff building up to it
> > isn't throwing the referral, the query you neglect to show is.
> >
> >  joe
> >
> >
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Mikael
> > Håkansson
> > Sent: Monday, February 28, 2005 4:10 AM
> > To: ActiveDir@mail.activedir.org
> > Subject: [ActiveDir] "A referral was returned from the server" when
> > executing a query.
> >
> > I´m working on an application for listing contacts and address lists
> > in active directory. But I get an error everytime I execute a query.
> >
> > I´m using the DirectoryServices namespace in .NET (which encapsulates
> > the Active Directory Service Interfaces) to communicate with Active
> > Directory
> >
> > 1. I bind to the RootDSE object to retrieve the DN of the
> > configuration container and the root domain.
> >  According to the log file, I get:
> >  Configuration container: DC=configuration,DC=myDomain,DC=com
> >  Root Domain: DC=myDomain,DC=com
> >
> > 2. I connect to the configuration

RE: [ActiveDir] "A referral was returned from the server" when ex ecuting a query.

2005-02-28 Thread joe
Hopefully JoeK will swing by shortly to say his piece on the NET call.

For the queries below, unless you want them scoped at a specific domain
anyway, consider querying a GC since all of those attribs are in the GC.

  joe


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mulnick, Al
Sent: Monday, February 28, 2005 9:19 AM
To: ActiveDir@mail.activedir.org
Subject: RE: [ActiveDir] "A referral was returned from the server" when ex
ecuting a query.

Can you include the code snippet where this occurs?

Have you tried using an alternate tool (LDP or Joe's ADFIND) to validate
that you don't get the same results from those tools?

??Is this a single domain forest that you're testing in? 

Al 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mikael Håkansson
Sent: Monday, February 28, 2005 9:06 AM
To: ActiveDir@mail.activedir.org
Subject: Re: [ActiveDir] "A referral was returned from the server" when
executing a query.

Any query throws the referral exception.

Like 

"(& (mailnickname=*) (|
(&(objectCategory=person)(objectClass=contact)) ))" which is from the "All
Contacts" address list.

or

"(& (mailnickname=*) (|
(&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServer
Name=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHome
ServerName=*)))(&(objectCategory=person)(objectClass=contact))(objectCategor
y=group)(objectCategory=publicFolder)(objectCategory=msExchDynamicDistributi
onList)
))"
whis is from the Default Global Address list.

Any ideas are welcome =)

Mikael Håkansson

On Mon, 28 Feb 2005 08:50:43 -0500, joe <[EMAIL PROTECTED]> wrote:
> 1. Cool
> 
> 2. Your search should use objectcategory, not objectclass.
> 
> 3a. Ok
> 
> 3b. What exactly is the query? The rest of the stuff building up to it 
> isn't throwing the referral, the query you neglect to show is.
> 
>  joe
> 
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Mikael 
> Håkansson
> Sent: Monday, February 28, 2005 4:10 AM
> To: ActiveDir@mail.activedir.org
> Subject: [ActiveDir] "A referral was returned from the server" when 
> executing a query.
> 
> I´m working on an application for listing contacts and address lists 
> in active directory. But I get an error everytime I execute a query.
> 
> I´m using the DirectoryServices namespace in .NET (which encapsulates 
> the Active Directory Service Interfaces) to communicate with Active 
> Directory
> 
> 1. I bind to the RootDSE object to retrieve the DN of the 
> configuration container and the root domain.
>  According to the log file, I get:
>  Configuration container: DC=configuration,DC=myDomain,DC=com
>  Root Domain: DC=myDomain,DC=com
> 
> 2. I connect to the configuration container and retrieve all the 
> address lists (using the directorySearcher with the filter 
> "(&(|(objectClass=addressBookContainer)(objectClass=msExchOAB))(purpor
> tedSea
> rch=*))"
> 
> ... so far so good ...
> 
> 3. I then connect using the value from the rootDomainNamingContext
property.
>  (this gives me the path: "LDAP://DC=myDomain,DC=com";)  This works 
> fine.
> 
> ... Now the problem begin ...
> 
> I use the .NET DirectorySearcher class to execute an ldap query agains 
> active directory.
> (the query is taken from the currently selected address list)
> 
> Whenever I execute a query, I get an exception:
> -2147016661  "A referral was returned from the server"
> 
> This is usually an indication that the DN is wrong (i.e the server 
> does not exist), but it doesn´t add up since I´m able to connect and 
> retrieve the address lists.
> 
> I have set the option to follow all referrals (subordinal & external).
> 
> Does anyone know what might be wrong?
> I´m pretty convinced it is not a programming error. Probably just my 
> lack of knowlegde regarding Active Directory :)
> 
> Thanks
> List info   : http://www.activedir.org/List.aspx
> List FAQ: http://www.activedir.org/ListFAQ.aspx
> List archive: 
> http://www.mail-archive.com/activedir%40mail.activedir.org/
> 
> List info   : http://www.activedir.org/List.aspx
> List FAQ: http://www.activedir.org/ListFAQ.aspx
> List archive: 
> http://www.mail-archive.com/activedir%40mail.activedir.org/
>
List info   : http://www.activedir.org/List.aspx
List FAQ: http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
List info   : http://www.activedir.org/List.aspx
List FAQ: http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

List info   : http://www.activedir.org/List.aspx
List FAQ: http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/


RE: [ActiveDir] "A referral was returned from the server" when ex ecuting a query.

2005-02-28 Thread Mulnick, Al
Can you include the code snippet where this occurs?

Have you tried using an alternate tool (LDP or Joe's ADFIND) to validate
that you don't get the same results from those tools?

??Is this a single domain forest that you're testing in? 

Al 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mikael Håkansson
Sent: Monday, February 28, 2005 9:06 AM
To: ActiveDir@mail.activedir.org
Subject: Re: [ActiveDir] "A referral was returned from the server" when
executing a query.

Any query throws the referral exception.

Like 

"(& (mailnickname=*) (|
(&(objectCategory=person)(objectClass=contact)) ))" which is from the "All
Contacts" address list.

or

"(& (mailnickname=*) (|
(&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServer
Name=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHome
ServerName=*)))(&(objectCategory=person)(objectClass=contact))(objectCategor
y=group)(objectCategory=publicFolder)(objectCategory=msExchDynamicDistributi
onList)
))"
whis is from the Default Global Address list.

Any ideas are welcome =)

Mikael Håkansson

On Mon, 28 Feb 2005 08:50:43 -0500, joe <[EMAIL PROTECTED]> wrote:
> 1. Cool
> 
> 2. Your search should use objectcategory, not objectclass.
> 
> 3a. Ok
> 
> 3b. What exactly is the query? The rest of the stuff building up to it 
> isn't throwing the referral, the query you neglect to show is.
> 
>  joe
> 
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Mikael 
> Håkansson
> Sent: Monday, February 28, 2005 4:10 AM
> To: ActiveDir@mail.activedir.org
> Subject: [ActiveDir] "A referral was returned from the server" when 
> executing a query.
> 
> I´m working on an application for listing contacts and address lists 
> in active directory. But I get an error everytime I execute a query.
> 
> I´m using the DirectoryServices namespace in .NET (which encapsulates 
> the Active Directory Service Interfaces) to communicate with Active 
> Directory
> 
> 1. I bind to the RootDSE object to retrieve the DN of the 
> configuration container and the root domain.
>  According to the log file, I get:
>  Configuration container: DC=configuration,DC=myDomain,DC=com
>  Root Domain: DC=myDomain,DC=com
> 
> 2. I connect to the configuration container and retrieve all the 
> address lists (using the directorySearcher with the filter 
> "(&(|(objectClass=addressBookContainer)(objectClass=msExchOAB))(purpor
> tedSea
> rch=*))"
> 
> ... so far so good ...
> 
> 3. I then connect using the value from the rootDomainNamingContext
property.
>  (this gives me the path: "LDAP://DC=myDomain,DC=com";)  This works 
> fine.
> 
> ... Now the problem begin ...
> 
> I use the .NET DirectorySearcher class to execute an ldap query agains 
> active directory.
> (the query is taken from the currently selected address list)
> 
> Whenever I execute a query, I get an exception:
> -2147016661  "A referral was returned from the server"
> 
> This is usually an indication that the DN is wrong (i.e the server 
> does not exist), but it doesn´t add up since I´m able to connect and 
> retrieve the address lists.
> 
> I have set the option to follow all referrals (subordinal & external).
> 
> Does anyone know what might be wrong?
> I´m pretty convinced it is not a programming error. Probably just my 
> lack of knowlegde regarding Active Directory :)
> 
> Thanks
> List info   : http://www.activedir.org/List.aspx
> List FAQ: http://www.activedir.org/ListFAQ.aspx
> List archive: 
> http://www.mail-archive.com/activedir%40mail.activedir.org/
> 
> List info   : http://www.activedir.org/List.aspx
> List FAQ: http://www.activedir.org/ListFAQ.aspx
> List archive: 
> http://www.mail-archive.com/activedir%40mail.activedir.org/
>
List info   : http://www.activedir.org/List.aspx
List FAQ: http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
List info   : http://www.activedir.org/List.aspx
List FAQ: http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/