La Web del Programador: Comunidad de Programadores
 
    Pregunta:  16695 - ENLAZAR CONTACTOS DE OUTLOOK CON VFP
Autor:  Toni
Me gustarĂ­a saber como puedo acceder a los contactos del Microsoft Outlook desde VFP.
Y como introducir nuevos contactos, con los datos de una tabla de VFP.

  Respuesta:  wences
este codigo lee la libreta de direcciones ...

*** ROC (Raid Outlook Contacts) 1.0
***
*** John Koziol (9/9/1999)
***
*** Swipes Contact info from Outlook. There are many more properties to grab, check
*** Outlook documentation for more information.

*!* PARAMETERS lZapFirst
*!* IF PARAMETERS() < 1
*!* lZapFirst=.F.
*!* ENDIF

SET TALK OFF
SET ECHO OFF
SET EXCL ON

USE vfpcontacts && The holding table
*!* IF lZapFirst && If Done with .T., ZAP holding table
*!* ZAP
*!* ENDIF
oOlApp = CreateObject("Outlook.Application") && Open Outlook

oOlNS = oOlApp.GetNameSpace("MAPI") && Set name space
oOlC = oOlNS.GetDefaultFolder(10) && 10 = Default contacts folder
SELECT vfpcontacts
FOR i = 1 TO oOlC.Items.Count
WAIT WIND "Record # "+ALLT(STR(i))+" of "+ALLT(STR(oOlC.Items.Count)) NOWAIT
INSERT INTO vfpcontacts (lastname,firstname,fullname,company,email1addr,email1disp,;
email2addr,email2disp,email3addr,email3disp,nickname) ;
VALUES ;
(oOlC.Items(i).LastName,;
oOlC.Items(i).FirstName,;
oOlC.Items(i).FullName,;
oOlC.Items(i).CompanyName,;
oOlC.Items(i).Email1Address,;
oOlC.Items(i).Email1DisplayName,;
oOlC.Items(i).Email2Address,;
oOlC.Items(i).Email2DisplayName,;
oOlc.Items(i).Email3Address,;
oOlC.Items(i).Email3DisplayName,;
oOlC.Items(i).NickName)

ENDFOR
*EDIT
*!* CLEAR ALL
*!* CLOSE ALL