?
Solved

How can I download attachment files from mail using PB and save them in specific path?

Posted on 2003-10-29
3
Medium Priority
?
846 Views
Last Modified: 2013-12-26
How can I download attachment files from mail i recieved using PB and save them in specific path? (any code example?)
0
Comment
Question by:Ofen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

Expert Comment

by:Vikas_Dixit
ID: 9642310
hi,
 ARE U USING THE mapI, OR SOME THIRD PARTY CONTROL ??
 This is what I find in the help of mailsession.mailReadMessage()

Reading attachments :  If a message has an attachment and you don't suppress attachments, information about it is stored in the AttachmentFile property of the mailMessage object. The AttachmentFile property is a mailFileDescription object. Its PathName property has the location of the temporary file that mailReadMessage created for the attachment. By default, the temporary file is in the directory specified by the TEMP environment variable.

You can copy these temp files to required location.

regards,
Vikas Dixit
0
 

Author Comment

by:Ofen
ID: 9643469
Hi,
I use the MAPI.
What does it means suppress attachment? why should I suppress?

AttachmentFile will give me the files name. what do I do with mailFileDescription
or how I connect it to something and do a file download? when does it put the file intemporary path?

do you have code example to implement it?

thanks,
Ofer
0
 
LVL 8

Accepted Solution

by:
Vikas_Dixit earned 1200 total points
ID: 9651689
Hi Ofen,

 I have not used the anove functions, so don't have any code.

Here's code snippet from PB Help :
Suppose you alredy have a mailsession connected (mSes)

mailMessage msg

long n, c_row

mSes.mailGetMessages()
FOR n = 1 to UpperBound(mSes.MessageID[])
    mSes.mailReadMessage(mSes.MessageID[n], msg, mailEnvelopeOnly! , FALSE)
    c_row = dw_1.InsertRow(0)
    dw_1.SetItem(c_row, "msgid", mSes.MessageID[n])
    dw_1.SetItem(c_row, "msgdate", msg.DateReceived)
    // Truncate subject to fit defined column size
    dw_1.SetItem(c_row, "msgsubject",   Left(msg.Subject, 50))
NEXT

Now if you want to see/move attachments of  say message no 6, then you can call

mSes.mailReadMessage(mSes.MessageID[6], msg, mailEntireMessage! , FALSE) // or use mailBodyAsFile!

After this call, the temporary files will be created. Now check the AttachmentFile[ ]       property

ls_nunAttachments = Upperbound( msg.AttachmentFile[ ])

 And you will have the path/name of temporary files corresponding to each attachment in the PathName property of each msg.AttachmentFile.

Hope this helps,
regards,
Vikas Dixit

 
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question