2
votes

I am trying to retrieve user photos that are stored in Active Directory with LDAP integration. I want to display pictures in a BSP application. I handled the login operation with the 'LDAP_SIMPLEBIND' function. It is working like a charm. However I cannot get photos. I tried 'LDAP_SEARCH' with this filter:

(&(objectCategory=person)(objectClass=user)(samaccountname=*))

This function is returning "thumbnailphoto" attribute but it is not a byte array that can be converted into jpeg or png file, I think!

Function call:

    CALL FUNCTION 'LDAP_SEARCH'
      EXPORTING
        base         = base
*       scope        = scope
*       mode         = mode
*       CROP         = 'X'
        filter       = filter
*       timeout      = timeout
*        IMPORTING
*       LDAPRC       = LDAPRC
      TABLES
        dns_out      = lt_dns_out
        attrs_io     = lt_attrs_io
        values_out   = lt_vals_out
      EXCEPTIONS
        no_authoriz  = 1
        conn_outdate = 2
        ldap_failure = 3
        not_alive    = 4
        other_error  = 5
        OTHERS       = 6.

In lt_attrs_io and lt_vals_out table, I have two lines about thumbnailphoto. I try to display in other views and in hex format.

enter image description here enter image description here

For example:

?#???yN?????uF

88218628259840

What am I missing? I cannot find anything on the web about this issue in ABAP. There are some solutions in C#, Java or nodejs, but nothing for ABAP as far as I see.

1
Why are you using an obsolete function module? Look at the documentation of LDAP_SEARCH. It says you should use LDAP_READ. Please do so and then see whether you can access your photo data more easily.Jagger
Well, I debugged the LDAP screen and LDAP_SEARCH is used behind the FIND operation. I never thought that It would be so simple, but I've just tried LDAP_READ. THUMBNAILPHOTO stored like xstring and it is working. :) Thanks a lot.Oguz

1 Answers

3
votes

The function module LDAP_SEARCH is marked as obsolete in its documentation. Please use LDAP_READ and your thumbnailphoto should be available in a convenient form to be read from (XSTRING).