Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

Operations error occurred on SearchByFristName() method.

Hello

I am getting

Error: Operations error

When I use this code, does any one know what the problem coudl be?

<%@ Language=JavaScript %>

<%

Fname=Request.querystring("FirstName")

try

{

var s = new ActiveXObject("LDAPSEARCH.LDAPSearchList");

s.server = "ldap.test.com";

s.port=389;

s.AuthName = "ldap";

s.AuthPasswd = "ldap";

s.searchbase = "DC=test,DC=com";

s.SetOutputTitle("Windows AD Search", 45);

s.SetOutputPrompt("Records %s to %e of total %c", 45);

s.AddReturnAttr("givenName,sn","Name","%1,%2", 20);

s.AddreturnAttr("telephonenumber","Telephone","%1", 20);

s.Addreturnattr("mail","Email","%1", 20);

s.AddSortingAttr("sn, givenName", 1);

s.SearchByFirstName(Fname);

//s.SearchAll();

s.SetSearchOption(100,10);

Response.ContentType = "text/xml";

Response.Write(s.XMLOutput(1, 32));

}

catch(err)

{

Response.Write("Error: " + err.description);

}

Response.End();

Session.Abandon();

%>

8 REPLIES

Re: Operations error occurred on SearchByFristName() method.

Have you tried setting correct capitals on the AddReturnAttr ?

and s.Port

New Member

Re: Operations error occurred on SearchByFristName() method.

I use windows DNS and AD, it uses port 389 for LDAP communication so I think that is ok.

What do you mean by capitals on rhe AddReturnAttr?

Is there any params wrong?

Thanks

Re: Operations error occurred on SearchByFristName() method.

We see this at least once a week, don't we? I can't help but point out that if you write your own search class you can debug the darned thing ;) I've yet to regret these two days I spent learning the LDAP basics in Java.

That aside, I think what s.monteiro inquired about is this:

s.AddreturnAttr("telephonenumber","Telephone","%1", 20);

Normally the attribute is called telephoneNumber.. so basically he asked you to verify if the attribute name matches the notation of the attribute in your directory. I know that AD uses telephoneNumber since I've written an ldap search for a client.

Re: Operations error occurred on SearchByFristName() method.

it's not what I meant, I mean the method calls themselves

s.port -> s.Port

s.Addreturnattr -> s.AddReturnAdd

s.AddreturnAttr -> s.AddReturnAdd

..see the capitals in the methods?

New Member

Re: Operations error occurred on SearchByFristName() method.

I am a PHP programmer and did not realized ASP is case sensitive.

I changed code a bit, in this code I am trying to return how many recrods got returned.

But I am getting "Error: An exception occurred"

Is there any way to get more info on what this exception about?

<%@ Language=JavaScript %>

<%

try

{

var s = new ActiveXObject("LDAPSEARCH.LDAPSearchList");

s.Server = "ldap.test.com";

s.Port=389;

s.AuthName = "ldap";

s.AuthPasswd = "ldap";

s.SearchBase = "DC=test,DC=com";

s.SetOutputTitle("Windows AD Search", 45);

s.SetOutputPrompt("Records %s to %e of total %c", 45);

s.SearchAll();

s.SetSearchOption(100,10);

Response.ContentType = "text/xml";

Response.Write(s.XMLOutput(1, 32));

}

catch(err)

{

Response.Write("Error: " + err.description);

}

Response.End();

Session.Abandon();

%>

One more question, if I want to use SearchByFirstName do I have to use SetSearchOption("givenName","FirstName",%1,20); ??? so it can return firstname?? or SetSearchOption does only display filtering and I get all the info no matter what ???

Thank you so much

Re: Operations error occurred on SearchByFristName() method.

Is PHP really case insensitive? It would be the first programming language I know that is (even though I've written my share of PHP code I'm not quite sure.. I always type things the way they're described in the PHP reference plus I'm using an IDE).

Either way, in the LDAPSearch programming guide 3.0 SetSearchOption has two shorts as parameters, no strings. Are you refering to AddReturnAttr ? Reading the documentation, you need to put every attribute in a AddReturnAttr if you want it returned as part of the result. I hope you are familiar with the documentation of that COM component.. there's just no substitute for a programming guide..

New Member

Re: Operations error occurred on SearchByFristName() method.

Ok I made this really simple, I just want to know if I am getting connection from the Domain controller.

After I execute this code I got

"Error: An exception occurred"

???????? I am completly lost here. what exception is it talking about? Can't it be more descriptive?

<%@ Language=JavaScript %>

<%

//Fname=Request.querystring("FirstName")

try

{

var s = new ActiveXObject("LDAPSEARCH.LDAPSearchList");

s.server = "ldap.test.com";

s.port=389;

s.AuthName = "ldap";

s.AuthPasswd = "ldap";

s.searchbase = "DC=test,DC=com";

s.SetOutputTitle("Windows AD Search", 45);

s.SetOutputPrompt("Records %s to %e of total %c", 45);

//s.AddReturnAttr("givenName,sn","Name","%1,%2", 20);

//s.AddreturnAttr("telephonenumber","Telephone","%1", 20);

//s.Addreturnattr("mail","Email","%1", 20);

//s.AddSortingAttr("sn, givenName", 1);

//s.SearchByFirstName(Fname);

s.SearchAll();

//s.SetSearchOption(100,10);

Response.ContentType = "text/xml";

Response.Write(s.XMLOutput(1, 32));

}

catch(err)

{

Response.Write("Error: " + err.description);

}

Response.End();

Session.Abandon();

%>

New Member

Re: Operations error occurred on SearchByFristName() method.

hi,

I have the same problem "Error: -2146827781 An exception occurred" when I run this script. I am also just requesting the total number of records so our scripts are very similiar (apart from searchbase and server locations of course). I wondered if you had found out what the problem is/was ??!

303
Views
0
Helpful
8
Replies
CreatePlease to create content