Solved

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

Posted on 2000-02-29
10
256 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 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

16 Experts available now in Live!

Get 1:1 Help Now