Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
dhborchardt
Partner - Creator
Partner - Creator

Provider AdsDSOObject problem

I used the example from the Cookbook and Groups part of it works fine. The Edit script\'Groups' tab works fine. the 'Users' tab script gets an error. I isolated it down to  "WHERE objectCategory='person' ". If the objectCategory='person', I will get an error.

________________________________________ ERROR  ______________________________

OLEDB read failed

SQL select

  name, distinguishedName

  FROM 'LDAP://DC=mhhc, DC=sisunet, DC=org'  WHERE objectCategory='person'

  AND name>' '

______________________________________________________________________________

If I replace person with group it works but I don't get the username. Can someone tell me what is wrong with using person or is there something else I am doing incorrect?

Microsoft Active Direcotry

QlikView 12 sr1 64bit

CONNECT TO 'Provider=ADsDSOObject';

LET arg=chr(01); // Set search start name to a very low value

DO

  ADUsers:

  //FIRST 1000 // Workaround for undefined SQL error.

  LOAD DISTINCT

  // Add addtional Fields as required

  name as UserName,

  distinguishedName as UserDN

  ;

  SQL select

  // Add addtional Fields as required

  name, distinguishedName // Fields to select

  FROM 'LDAP://$(RootDse)'  WHERE objectCategory='person'

  AND name>'$(arg)'; // Get rows where "name" is GT the arg

  EXIT DO WHEN ScriptError > 1 // Stop loop if SELECT has error

  EXIT DO WHEN NoOfRows('nameTable') = 0;  // Stop loop if SELECT returns nothing

  EXIT DO WHEN peek('UserName') = '$(arg)';  // If the last "name" read is EQ to arg -- no more entries

  LET arg=peek('UserName'); // Set the arg to the last "name" read

LOOP

1 Solution

Accepted Solutions
dhborchardt
Partner - Creator
Partner - Creator
Author

I managed to get what I want but did it in the SQL where I should have been looking to begin with.

I relied heavily on this page:  "https://www.mssqltips.com/sqlservertip/2580/querying-active-directory-data-from-sql-server/#comments..."

At first I was getting the results in text format. I needed to go to Tools/Options/Query Results in Management Studio to change it to Grid.

View solution in original post

1 Reply
dhborchardt
Partner - Creator
Partner - Creator
Author

I managed to get what I want but did it in the SQL where I should have been looking to begin with.

I relied heavily on this page:  "https://www.mssqltips.com/sqlservertip/2580/querying-active-directory-data-from-sql-server/#comments..."

At first I was getting the results in text format. I needed to go to Tools/Options/Query Results in Management Studio to change it to Grid.