/***************************************************************************** LEGAL: This program is provided for FREE. There is NO warranty either written or implied. *****************************************************************************/ DEFINE TEMP-TABLE InternMail FIELD email AS CHAR FORMAT "X(80)" FIELD name AS CHAR FORMAT "X(80)" INDEX ix_email email INDEX ix_name name. DEFINE OUTPUT PARAMETER table FOR InternMail. DEFINE BUFFER bMail FOR InternMail. DEFINE VARIABLE hMapi AS com-handle NO-UNDO. DEFINE VARIABLE hItem AS com-handle NO-UNDO. DEFINE VARIABLE hRecipients AS com-handle NO-UNDO. DEFINE VARIABLE hField AS com-handle NO-UNDO. DEFINE VARIABLE iCount AS INT NO-UNDO. DEFINE VARIABLE i AS INT NO-UNDO. CREATE "mapi.session" hMapi. FOR EACH bMail: delete bMail. END. hMapi:Logon('MS Exchange Settings', false). iCount = hMapi:Addresslists:Count. hRecipients = ?. DO i = 1 TO iCount: hItem = hMapi:AddressLists:Item(i). IF hItem:Name = 'Recipients' THEN /* Find apropiate contact folder */ hRecipients = hItem:AddressEntries. RELEASE OBJECT hItem. END. IF hRecipients <> ? THEN DO: iCount = hRecipients:Count. DO i = 1 TO iCount: hItem = hRecipients:Item(i). IF hItem:DisplayType = 0 AND num-entries(hItem:name,' ') >= 2 THEN DO: hField = hItem:Fields(12). CREATE bMail. ASSIGN bMail.Name = hItem:Address bMail.Email = hField:Value. RELEASE OBJECT hField. END. RELEASE OBJECT hItem. END. END. RELEASE OBJECT hRecipients. RELEASE OBJECT hMapi.