Solved

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

Posted on 2000-02-29
10
255 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now