Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with Mapimail.vcx
Message
 
To
19/02/2001 11:14:52
Peter Wagner
Point Informática Ltda.
Limeira, Brazil
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00477327
Message ID:
00477367
Views:
44
Sorry for not replying by email but my PC serving the net blew it's power supply. I've just tested this using the command line in VFP and it works (returns correct number of attachments).

I suggest you try the same (type in the commands and check you're looking at the correct mail by using ?loMail.GetSubject()). One important point is that message 1 is the OLDEST message in your inbox.

>I'm trying to develop am app to get the attached file from an
>e-mail from Outlook Express sended by someone using the
>Mapimail class createt by Nigel Coates.
>
>Has someone an ideia how or why GETATTACHMENTCOUNT() returns allways 0
>is there a workaround to handle this problem ?
>could someone help me please!
>
>TIA
>
>I have written this little sample code for test:
>SET CLASSLIB TO mapimail ADDITIVE
>enviado_por = "Alexandre Martins Dantas" && send by
>data_ini = {^2001/01/01} && start Date
>data_fim = DATE() && end Date
>loMail = CREATEOBJECT("cusMAPI") && Load class for e-mail
>lnMail = loMail.ReadMail("","",.F.,enviado_por,"",data_ini, data_fim,.T.)
>IF lnMail > 0 && If exist e-mail send by this person
> nMensagem = loMail.GetFirstMessage()&& get the first message from this person
>* Problem starts next line because allways it returns 0 from GETATTACHMENTCOUNT
>* even if I see in Outlook Express attached files in the mail.
>
>nArqAtachado = loMail.GetAttachmentCount(nMensagem) && verify if a file there
>IF nArqAtachado <> 0 && If exist a file attached
> FOR N = 1 TO nArqAtachado && get the file
> z = loMail.GetAttachmentFile(N)
> IF UPPER(JUSTEXT(z)) = "XLS" && If the attached file is an excel file
> COPY FILE z TO C:\_teste_vfp\e_mail\acoes.XLS && copy file to dir.
>*=copy_to_dbf("acoes.xls") && copy information to Table and delete xls file
> ENDIF
> ENDFOR
> lnMailx = lnMail + 1
> DO WHILE lnMailx <= lnMail
> = loMail.GetNextMessage()
> nArqAtachado = loMail.GetAttachmentCount(nMensagem) && verify in an file
> IF nArqAtachado <> 0
> FOR N = 1 TO nArqAtachado && get the file
> z = loMail.GetAttachmentFile(N)
> IF UPPER(JUSTEXT(z)) = "XLS"
> COPY FILE z TO C:\_teste_vfp\e_mail\acoes.XLS && copy file to dir.
> *=copy_to_dbf("acoes.xls") && copy information to Table and delete xls file
> ENDIF
> ENDFOR
> ENDIF
> lnMailx = lnMailx + 1
>ENDDO
>ENDIF
>ENDIF
Nigel B Coates
NBC Software Services
Dublin, Ireland.
eMail: Nigel.Coates@NBCSoftware.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform