Solved

URGENT : MAPI32 API for use in VB (more points possible)

Posted on 2000-02-29
10
258 Views
Last Modified: 2008-03-17
I need to do the following with MAPI32 API (please send detailed VB code) :

1) LogOn
2) Fetch all emails from the default email client's in-box and search for all emails that have attachments (get the FileCount to know how many attachments an e-mail contains)
4) Retrieve the FileName, FilePath, Position of these attachments
5) Retrieve the name of the Sender, the Subject, NoteText, DateReceived and ConversationID of emails.
6) LogOff

This code should work with the following email clients : Outlook, Outlook Express, Exchange, Netscape.
More points may be available if the answer is very good.
Thank you.
Minette
0
Comment
Question by:minette
  • 6
  • 3
10 Comments
 
LVL 3

Expert Comment

by:carruina
ID: 2570502
Try with this code:



Private Sub Command1_Click()
MAPISession.SignOn
DoEvents
MAPIMensaje.SessionID = MAPISession.SessionID
'MAPIMensaje.FetchUnreadOnly = True
MAPIMensaje.Fetch
For i = MAPIMensaje.MsgCount - 1 To 0 Step -1
    MAPIMensaje.MsgIndex = i
    If MAPIMensaje.AttachmentCount >= 1 Then
        'Retrieve the name of the Sender, the Subject, NoteText, DateReceived and ConversationID of emails.
        MsgBox MAPIMensaje.MsgConversationID
        MsgBox MAPIMensaje.MsgOrigAddress
        MsgBox MAPIMensaje.MsgSubject
        MsgBox MAPIMensaje.MsgNoteText
        MsgBox MAPIMensaje.MsgDateReceived
        'Retrieve the FileName, FilePath, Position of these attachments
        For j = 0 To MAPIMensaje.AttachmentCount - 1
            MAPIMensaje.AttachmentIndex = j
            'In NT AttachmentName <> AttachmentPathName
            'In W95 some timmes AttachmentName = AttachmentPathName
            MsgBox MAPIMensaje.AttachmentName
            MsgBox MAPIMensaje.AttachmentPathName
            MsgBox MAPIMensaje.AttachmentPosition
        Next j
    End If
Next i
MAPISesion.SignOff
End Sub
0
 

Author Comment

by:minette
ID: 2570855
I need to achieve this only with API calls, not with the MAPI ocx.
0
 

Author Comment

by:minette
ID: 2571064
Outlook Express 5.0 and Netscape don't support MAPIMensaje.AttachmentCount

I need a solution with API calls, not the OCX.
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 9

Expert Comment

by:Ruchi
ID: 2571564
0
 

Author Comment

by:minette
ID: 2572895
Ruchi,
Sorry but the URL you gave is for sending mail.
What I need is to read email from the in-box and have access to their attachments.
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2577101
I don't think there is to achieve this problem with API calls.

for MAPI ocx.

Go to:
http://members.home.com/abstractvb/vbcode/vbc-tut-mapi.htm
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2577122
Or, if you don't want to use MAPI, you can use socket..

go to
http://members.home.com/abstractvb/vbcode/vbc-net-smtp.htm
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2577142
0
 
LVL 9

Accepted Solution

by:
Ruchi earned 250 total points
ID: 2577158
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2603383
Minette: Where are you? Please post something so we could be of any help to you. Thank you very much.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

730 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