Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Email receive
Message
De
01/01/2008 12:59:17
 
 
À
01/01/2008 12:21:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01278474
Message ID:
01278818
Vues:
26
Thank you

I think that we speak about two diffrent errors.
Probably universalthread lost my other problem (I got universalthread error).
My biggest problem now is that I cannt get more than one mail.
I explaind here about this error not about the error that I got from my folder.
I will show the code (again - on regular inbox folder) - why i get problem in second mail.
It's important to mark that outlook moving the first email to the 'deleted item' folder.
*Connect to Outlook
  aplicacao = createobject("outlook.application")
  espaco = aplicacao.GetNamespace("MAPI")

* Instantiate 'Inbox' folder

 **** inbox = espaco.GetDefaultFolder('aabbcc')&&error
 ****inbox=espaco.GetMailFolder('aabbcc')&&error
  inbox = espaco.GetDefaultFolder(6)

* Instantiate 'Deleted Items' folder
  eliminados = espaco.GetDefaultFolder(3)

* Count messages in Inbox
  Contagem = inbox.Items.Count

if Contagem>150
messagebox('You have '+alltrim(str(Contagem))+' Emails in your Outlook Inbox, Please Clear it To 100 - Maximum.'+chr(10)+'THE OPERATION CANCELD!',0+16) 
return
endif

inewemails=0
* Navigate messages
  for i = 1 to contagem

    * Get specific message
      mensagem = inbox.items(i)

    * Read message 'subject' field
      assunto = alltrim(mensagem.subject)
if left(assunto,2)<>'TR'
loop
endif
inewemails=inewemails+1
    * Count attachments
      total_attachments = mensagem.attachments.count

    * Read attachments and save it to a disk folder
      if total_attachments > 0

        * Browse through attachments
          for x = 1 to total_attachments
              nomeficheiro = mensagem.attachments(x).filename
              nomeficheiro2 = "C:\exps\sent\" + m.nomeficheiro
              mensagem.attachments(x).saveasfile(nomeficheiro2)
          next
      endif

    * Move the complete message to deleted items
    * remember that object 'eliminados' is an instance to
    * 'deleted items' folder
      mensagem.Move(eliminados)

    * release message objects
      mensagem = null
      assunto = null
  next

* Close outlook
  aplicacao.quit

* Release objects
  aplicacao = null
  espaco = null
  inbox = null
  Contagem = null
  eliminados = null
  
 if inewemails=0
 messagebox('No Emails Arrived',0+64)
 else
cnewemails=alltrim(str(inewemails))
messagebox(cnewemails +'  Email/s Imported successfuly!',0+64)
endif
>* Count messages in Inbox
>Contagem = inbox.Items.Count

>
>The inbox can contain either e-mail messages or other folders.
>
>So I would usew code like this to process the items in the Inbox:
>
>
>*** Get a local referenece to the collection of of items in the Inbox
>loItems = loInbox.Items
>
>*** Process all the items in the inbox
>*** If it is a mail item, save it and process the attachments
>IF VARTYPE( loItems ) = 'O'
>  FOR EACH loItem IN loItems
>    IF loItem.Class = 43 && olMail	
>      *** Process the message and the attachments
>    ENDIF
>  ENDFOR
>ENDIF
>
>
>* Move the complete message to deleted items
> * remember that object 'eliminados' is an instance to
> * 'deleted items' folder
> mensagem.Move(eliminados)

>
>This has the effect of making the count of the items collection less than your loop limit ( contagem ). I would expect an Error 1234: Subscript is outside defined range.
>
>
loRootFolder = oNameSpace.GetDefaultFolder( 6 ) && Inbox
Thank you
Chaim
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform