Usando Outlook

Usando Outlook

Postby Antonio Linares » Tue May 14, 2013 6:30 am

Code: Select all  Expand view
function Main()

   local olApp := CreateObject( "Outlook.Application" )
   local olns := olApp:GetNameSpace( "MAPI" )
   local oUserFolder := olns:Folders( "alinares@fivetechsoft.com" )
   local oFolder := oUserFolder:Folders( "Bandeja de entrada" )
   local n
 
   MsgInfo( "Total emails: " + AllTrim( Str( oFolder:Items:Count ) ) )
 
   for n = 1 to Min( oFolder:Items:Count, 10 )
      MsgInfo( oFolder:Items( n ):Subject )
   next

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Usando Outlook

Postby karinha » Tue May 14, 2013 12:25 pm

Maestro, esto és para bajar mis emails?

salu2
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Usando Outlook

Postby Antonio Linares » Tue May 14, 2013 12:52 pm

Es para leer los emails que haya en tu bandeja de entrada (inbox).
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Usando Outlook

Postby karinha » Tue May 14, 2013 1:03 pm

Application
===========
Path and name: c:\FWH1303\samples\teste.exe (32 bits)
Size: 1,966,592 bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20130326)
FiveWin Version: FWHX 13.02
Windows version: 6.1, Build 7601 Service Pack 1

Time from start: 0 hours 0 mins 0 secs
Error occurred at: 05/14/13, 10:01:13
Error description: Error TOleAuto/65535 : TOLEAUTO:NEW
Args:
[ 1] = C Outlook.Application
[ 2] = U
[ 3] = U

Stack Calls
===========
Called from: => THROW( 0 )
Called from: source\rtl\win32ole.prg => TOLEAUTO:NEW( 0 )
Called from: source\rtl\win32ole.prg => CREATEOBJECT( 0 )
Called from: teste.prg => MAIN( 5 )

System
======
CPU type: AMD Phenom(tm) II X4 820 Processor 2817 Mhz
Hardware memory: 3072 megs

Free System resources: 90 %
GDI resources: 90 %
User resources: 90 %

Windows total applications running: 10
1 , C:\Program Files\Avira\AntiVir Desktop\avgnt.exe
2 , C:\Program Files\Windows Live\Mail\wlmail.exe
3 , C:\Users\Joao\AppData\Local\Google\Chrome\Application\chrome.exe
4 , C:\Windows\Explorer.EXE
5 Advanced Spyware Remover, C:\Program Files\IObit\Advanced Spyware Remover\ASRtray.exe
6 CiceroUIWndFrame, C:\Windows\system32\taskhost.exe
7 DWM Notification Window, C:\Windows\system32\Dwm.exe
8 MSCTFIME UI, C:\Windows\system32\conhost.exe
9 Prompt de Comando - buildx teste, C:\Windows\system32\cmd.exe
10 TaskEng - Processo de Mecanismo do Agendador de Tarefas, C:\Windows\system32\taskeng.exe

Variables in use
================
Procedure Type Value
==========================
THROW
Param 1: O Class: ERROR
Local 1: U
Local 2: U
TOLEAUTO:NEW
Param 1: C "Outlook.Application"
Param 2: U
Param 3: U
Local 1: O Class: TOLEAUTO
Local 2: O Class: ERROR
CREATEOBJECT
Param 1: C "Outlook.Application"
Local 1: U
MAIN
Local 1: U
Local 2: U
Local 3: U
Local 4: U
Local 5: U

Linked RDDs
===========
DBF
DBFFPT
DBFBLOB
DBFNTX

DataBases in use
================

Classes in use:
===============
1 ERROR
2 HASHENTRY
3 HBCLASS
4 TOLEAUTO
5 HBOBJECT
6 TREG32

Memory Analysis
===============
163 Static variables

Dynamic memory consume:
Actual Value: 0 bytes
Highest Value: 0 bytes

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Usando Outlook

Postby Antonio Linares » Tue May 14, 2013 1:11 pm

Do you have Outlook installed on your computer ? :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Usando Outlook

Postby karinha » Tue May 14, 2013 1:18 pm

Antonio Linares wrote:Do you have Outlook installed on your computer ? :-)



No. Windows Live Mail de Windows 7 (seven)

Noo ejiste outlook para windows 7 e si windows live mail.

regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Usando Outlook

Postby acuellar » Tue May 14, 2013 7:34 pm

Gracias Antonio.

Funciona perfecto.

Saludos,

Adhemar
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1643
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Usando Outlook

Postby acuellar » Tue May 14, 2013 8:07 pm

Antonio

En algunos Outlook el folder se llama: Bandeja de entrada y en otros Inbox

Como preguntar para saber como está escrito y no de error?

Gracias

Saludos,

Adhemar
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1643
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Usando Outlook

Postby Antonio Linares » Wed May 15, 2013 8:33 am

Adhemar,

No se si será posible localizar esa carpeta por su nombre, porque además pueden existir varias cuentas. En mi caso, para hacer el ejemplo, di de alta mi cuenta de correo y creo una carpeta con mi email, por eso en el ejemplo uso mi email (que es la carpeta en donde Outlook ha puesto mi correo).

Supongo que podremos listar todos los nombres y compararlos con algo determinado como "Inbox", "Bandeja de entrada", etc.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Usando Outlook

Postby Antonio Linares » Wed May 15, 2013 8:34 am

Prueba con olsn:Folder( n ):Count y olns:Folder( n ):name en un bucle for...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Usando Outlook

Postby Antonio Linares » Wed May 15, 2013 8:36 am

y a su vez puedes revisar las subcarpetas con olsn:Folder( n ):Folders:Count y olsn:Folder( n ):Folders( y ):Name
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Usando Outlook

Postby acuellar » Wed May 15, 2013 4:48 pm

Gracias Antonio

Hice como me indicas
Code: Select all  Expand view

 For n:=1 to 7
           ?olns:Folder( n ):Count
           ?olns:Folder( n ):name
Next n
 


y me da este error
Error description: Error Outlook.Application:GETNAMESPACE/0 S_OK: FOLDER
Args:
[ 1] = N 1

Saludos,

Adhemar
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1643
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Usando Outlook

Postby Patricio Avalos Aguirre » Wed May 15, 2013 5:17 pm

probanste con (s)

Code: Select all  Expand view
?olns:Folders( n ):Count
Saludos
Patricio

__________________________________________________________________
Version: Harbour 3.2.0dev (r1307082134),Compiler: Borland C++ 5.8.2 (32-bit)
PCode version: 0.3, FWH 13.2
http://www.sialm.cl
User avatar
Patricio Avalos Aguirre
 
Posts: 1060
Joined: Fri Oct 07, 2005 1:56 pm
Location: La Serena, Chile

Re: Usando Outlook

Postby hmpaquito » Wed May 15, 2013 5:22 pm

Supongo que podria funcionar asi:
Code: Select all  Expand view
oFolder := oUserFolder:Folders( "Bandeja de entrada" )
IF oFolder == NIL
   oFolder:= oUserFolder:Folders( "Inbox" )
   IF oFolder == NIL
       MsgInfo("¿ Cómo diantres era tu nombre ?")
   ENDIF
ENDIF


Aunque tambien se puede hacer asi:
Code: Select all  Expand view
oOutLook:= CreateObject("OutLook.Application")
oNameSpace:= oOutLook:GetNameSpace("MAPI")
oNameSpace:Logon()
oFolder:= oNameSpace:GetDefaultFolder(6)
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Usando Outlook

Postby acuellar » Wed May 15, 2013 6:29 pm

Gracias Distinguidos

Lo solucioné así:
Code: Select all  Expand view

   oFolder := oUserFolder:Folders( 2 ) //Bandeja de entrada/Inbox
 

El:
1 Eliminados
2 Bandeja de entrada
3 Bandeja de salida
4 Enviados
5 Borradores

Saludos,

Adhemar
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1643
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Next

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 55 guests