Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: 24 Jun 2005 03:29:27 -0700,    group: microsoft.public.platformsdk.active.directory        back       


ldap_search_s result - how to get wanted output   
hi all,

i have a question to the ldap_search_s function. i call this function
in the following way:

ldap_search_s(pldap,base,LDAP_SCOPE_SUBTREE,filter,attrs,0,&result);


the variable attrs has following values:
attrs={"name","sn","cn",NULL};


after the search-function i call the fnctions like ldap_first_entry,
ldap_first_attribute, ldap_get_values ... then i get the right output,
put not in the right order.

a short example:
function call with:			->		output
attrs={"att1","att2","att3",NULL}			att3,att1,att2



i want to have the same order like in the variable attrs:

for example: i call the ldap_search_s with
atrrs={"name","sn","cn",NULL} i also want to have the output in the
same way... that means

another short example:
function call with:			->		output
attrs={"att1","att2","att3",NULL}			att1,att2,att3


any ideas how to solve this problem?

regards,
berni
date: 24 Jun 2005 03:29:27 -0700   author:   (berni_z)

Re: ldap_search_s result - how to get wanted output   
I don't think there is anything that requires the output to be in the same order 
as the request, you would need to do one of two things.

First you could retrieve all of the attributes and then reorder then in your 
list or whatever structure you are keeping them in.

Second you could ask for them specifically in order with ldap_get_values like

char **apszName=ldap_get_values(pLdap, pMsg, "name");
char **apszSN=ldap_get_values(pLdap, pMsg, "sn");
char **apszCN=ldap_get_values(pLdap, pMsg, "cn");



--
Joe Richards Microsoft MVP Windows Server Directory Services
www.joeware.net


berni_z wrote:
> hi all,
> 
> i have a question to the ldap_search_s function. i call this function
> in the following way:
> 
> ldap_search_s(pldap,base,LDAP_SCOPE_SUBTREE,filter,attrs,0,&result);
> 
> 
> the variable attrs has following values:
> attrs={"name","sn","cn",NULL};
> 
> 
> after the search-function i call the fnctions like ldap_first_entry,
> ldap_first_attribute, ldap_get_values ... then i get the right output,
> put not in the right order.
> 
> a short example:
> function call with:			->		output
> attrs={"att1","att2","att3",NULL}			att3,att1,att2
> 
> 
> 
> i want to have the same order like in the variable attrs:
> 
> for example: i call the ldap_search_s with
> atrrs={"name","sn","cn",NULL} i also want to have the output in the
> same way... that means
> 
> another short example:
> function call with:			->		output
> attrs={"att1","att2","att3",NULL}			att1,att2,att3
> 
> 
> any ideas how to solve this problem?
> 
> regards,
> berni
date: Sat, 25 Jun 2005 17:07:48 -0400   author:   Joe Richards [MVP]

Re: ldap_search_s result - how to get wanted output   
thanx a lot!

i chose the 2nd solution. when i saw your suggestions i had to ask
myself, why i hadn't been able to solve it on my own. only a few
simple steps and my problem was gone...
anyway, thank you for your help...

regards,
berni



"Joe Richards [MVP]"  wrote in message news:...
> I don't think there is anything that requires the output to be in the same order 
> as the request, you would need to do one of two things.
> 
> First you could retrieve all of the attributes and then reorder then in your 
> list or whatever structure you are keeping them in.
> 
> Second you could ask for them specifically in order with ldap_get_values like
> 
> char **apszName=ldap_get_values(pLdap, pMsg, "name");
> char **apszSN=ldap_get_values(pLdap, pMsg, "sn");
> char **apszCN=ldap_get_values(pLdap, pMsg, "cn");
> 
> 
> 
> --
> Joe Richards Microsoft MVP Windows Server Directory Services
> www.joeware.net
> 
> 
> berni_z wrote:
> > hi all,
> > 
> > i have a question to the ldap_search_s function. i call this function
> > in the following way:
> > 
> > ldap_search_s(pldap,base,LDAP_SCOPE_SUBTREE,filter,attrs,0,&result);
> > 
> > 
> > the variable attrs has following values:
> > attrs={"name","sn","cn",NULL};
> > 
> > 
> > after the search-function i call the fnctions like ldap_first_entry,
> > ldap_first_attribute, ldap_get_values ... then i get the right output,
> > put not in the right order.
> > 
> > a short example:
> > function call with:			->		output
> > attrs={"att1","att2","att3",NULL}			att3,att1,att2
> > 
> > 
> > 
> > i want to have the same order like in the variable attrs:
> > 
> > for example: i call the ldap_search_s with
> > atrrs={"name","sn","cn",NULL} i also want to have the output in the
> > same way... that means
> > 
> > another short example:
> > function call with:			->		output
> > attrs={"att1","att2","att3",NULL}			att1,att2,att3
> > 
> > 
> > any ideas how to solve this problem?
> > 
> > regards,
> > berni
date: 27 Jun 2005 01:32:45 -0700   author:   (berni_z)

Re: ldap_search_s result - how to get wanted output   
No problem, those were very short examples, make sure you test that you get 
valid values back before you do anything. On the flip side you can test by 
pulling an object that doesn't have say the sn and see how your program responds.

--
Joe Richards Microsoft MVP Windows Server Directory Services
www.joeware.net


berni_z wrote:
> thanx a lot!
> 
> i chose the 2nd solution. when i saw your suggestions i had to ask
> myself, why i hadn't been able to solve it on my own. only a few
> simple steps and my problem was gone...
> anyway, thank you for your help...
> 
> regards,
> berni
> 
> 
> 
> "Joe Richards [MVP]"  wrote in message news:...
> 
>>I don't think there is anything that requires the output to be in the same order 
>>as the request, you would need to do one of two things.
>>
>>First you could retrieve all of the attributes and then reorder then in your 
>>list or whatever structure you are keeping them in.
>>
>>Second you could ask for them specifically in order with ldap_get_values like
>>
>>char **apszName=ldap_get_values(pLdap, pMsg, "name");
>>char **apszSN=ldap_get_values(pLdap, pMsg, "sn");
>>char **apszCN=ldap_get_values(pLdap, pMsg, "cn");
>>
>>
>>
>>--
>>Joe Richards Microsoft MVP Windows Server Directory Services
>>www.joeware.net
>>
>>
>>berni_z wrote:
>>
>>>hi all,
>>>
>>>i have a question to the ldap_search_s function. i call this function
>>>in the following way:
>>>
>>>ldap_search_s(pldap,base,LDAP_SCOPE_SUBTREE,filter,attrs,0,&result);
>>>
>>>
>>>the variable attrs has following values:
>>>attrs={"name","sn","cn",NULL};
>>>
>>>
>>>after the search-function i call the fnctions like ldap_first_entry,
>>>ldap_first_attribute, ldap_get_values ... then i get the right output,
>>>put not in the right order.
>>>
>>>a short example:
>>>function call with:			->		output
>>>attrs={"att1","att2","att3",NULL}			att3,att1,att2
>>>
>>>
>>>
>>>i want to have the same order like in the variable attrs:
>>>
>>>for example: i call the ldap_search_s with
>>>atrrs={"name","sn","cn",NULL} i also want to have the output in the
>>>same way... that means
>>>
>>>another short example:
>>>function call with:			->		output
>>>attrs={"att1","att2","att3",NULL}			att1,att2,att3
>>>
>>>
>>>any ideas how to solve this problem?
>>>
>>>regards,
>>>berni
date: Mon, 27 Jun 2005 09:24:19 -0400   author:   Joe Richards [MVP]

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us