Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mapi
Message
 
 
À
05/01/1999 17:04:43
Gordon Evans
Megabyte Computer Services Ltd
Sheffield, Royaume Uni
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Re: Mapi
Divers
Thread ID:
00172941
Message ID:
00172961
Vues:
38
Gordon,

It's not a conspiracy, even though it seems like it *s*

You must make sure you are using at least the first SP1 version of IE4 if OE is your Simple MAPI client otherwise there's some significant bugs trying to get the attachments.

When the message is opened the attachments are in the windows temporary folder. So all you have to do is copy them to where you want.

Here's some code out of one of my apps that gets attachments:
with this.cntMAPI

   .Fetch() && Get the messages in the Inbox to the read buffer

   .GetMessage() && get first message
   
   for i = 1 to .mnMsgCount
      if ( at( "AGE.", .MsgSubject ) = 1 )
         .GetAttachment()
         * message to process
         thisform.Refresh() && update the display

         llProcessed = .f.
         do case

            case ( at( EMAIL_TYPE_CODES, .MsgSubject ) > 0 )
               llProcessed = this.ImportCodes()

         endcase
         if ( llProcessed )
            .DeleteMessage()
         endif
      endif
      .GetNextMessage() && iterate to next message
   endfor

* ImportCodes() method
if ( this.cntMAPI.mnAttachmentCount != 6 )
   MessageBox( "Unexpected number of attached files", MB_OK, _screen.Caption )
   this.ctnMAPI.txtStatus.Value = "Import Terminated"
   return .f.
endif

this.txtImportType.Value = EMAIL_DESCR_CODES
*this.Refresh()

local lcBackupDir

lcBackupDir = ".\Backup\" + dtos( date() )

this.ImportFile( "codes.dbf" )
this.ImportFile( "codes.cdx" )
this.ImportFile( "codeclass.dbf" )
this.ImportFile( "codeclass.cdx" )
this.ImportFile( "codeapplies.dbf" )
this.ImportFile( "codeapplies.cdx" )

this.cntMAPI.txtStatus.Value = "Successful Import"

* ImportFile() method
lparameter pcFileName

this.cntMAPI.txtStatus.Value = "Importing " + pcFileName

local lcInFile

lcInFile = sys(2023) + "\" + pcFileName
if ( file( lcInFile ) )
   copy file (lcInFile) to (pcFileName)
else
   ErrorLog( "Can't find file:" + lcInFile + " " + pcFileName ) && 28-Apr-98
   MessageBox( "Can't find file:" + lcInFile, MB_ICONEXCLAMATION, _screen.Caption )
endif
>Now I've got the sending of attached files by MAPI working.
>
>I need now to be able to un attach into a folder!
>Has anyone seen or have sample code for retrieving attached file from email using
> Mapi?
>I've tried the MSDN with no success.
>
>Solutions examples only show sending. I think that's suspicious ;)
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform