Answered Get User Name from OutLook

rzr

Member
How can I retrieve the user full name as dispalyed / stored in MS OutLook? I'm able to retrieve the login id of user on Windows using the below API.

If it possible to use this login-id and then 'query' the MS OutLook to get the user full name?

Code:
DEFINE VARIABLE chrUserID AS LONGCHAR NO-UNDO.                 
DEFINE VARIABLE mUserId  AS MEMPTR  NO-UNDO.                 
DEFINE VARIABLE intResult AS INTEGER  NO-UNDO.                 
DEFINE VARIABLE intSize  AS INTEGER  NO-UNDO.                 
                                                               
PROCEDURE GetUserNameA EXTERNAL "ADVAPI32.DLL":                 
                                                               
    DEFINE INPUT PARAMETER        mUserId      AS MEMPTR NO-UNDO.
    DEFINE INPUT-OUTPUT PARAMETER intBufferSize AS LONG  NO-UNDO.
    DEFINE RETURN PARAMETER      intResult    AS SHORT  NO-UNDO.
                                                               
END PROCEDURE.                                                 
                                                               
SET-SIZE(mUserId) = 256.                                       
inTSIZE = 255.                                                 
                                                               
RUN GetUserNameA (INPUT        mUserId,                         
                  INPUT-OUTPUT intSize,                         
                  OUTPUT      intResult).                     
                                                               
copy-lob mUserId for (intSize - 1) to chrUserID.               
                                                               
IF intResult = 1 THEN                                           
    MESSAGE "Logon ID = " string(chrUserID) VIEW-AS ALERT-BOX. 
                                                               
ELSE                                                           
    MESSAGE "Failed to retrive Logon ID" VIEW-AS ALERT-BOX.
 
Top