473,776 Members | 1,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using VB.NET and MAPI to retrieve Exchange EMail Attachments

3 New Member
Hi,
I am rewriting code from VB6 using MAPI into VB.NET

I need to read an attachment off an email on an Exchange Server.
In the old VB6 (not written by me) they restrict the Messages.type to "IPM.NOTE" on the Inbox and then retrieve any attachments.

If I do the same in VB.NET, any email I receive that has an attachment is not picked up if I restrict for "IPM.NOTE".

If I don't filter on IPM.NOTE, the email with attachment is detected...

Can someone help me with this?

Here is some of my code:

dim oSession as MAPI.Session
Dim oInbox As MAPI.Folder
Dim oMessages As MAPI.Messages
Dim oMsg As MAPI.Message
Dim oAttachment As MAPI.Attachment s
Dim oAttach As MAPI.Attachment
Dim oFilter As MAPI.MessageFil ter

oSession = CreateObject("M API.Session")

oInbox = oSession.Inbox

oMessages = oInbox.Messages

oFilter = oMessages.Filte r
oFilter.Type = "IPM.Note"
oFilter.Unread = True
If oMessages.Count > 0 Then

'My code doesn't find any emails here if has attachment'

For iMsg As Integer = 1 To oMessages.Count

oMsg = oMessages.Item( iCount)

oAttachment = oMsg.Attachment s

If oAttachment.Cou nt > 0 Then
....
....
Next
Aug 22 '07 #1
1 5133
kenobewan
4,871 Recognized Expert Specialist
Are you wanting to convert the code to vb.net? VS 2003 can assist if you are wanting 1.1.
Aug 22 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
570
by: Jerry | last post by:
I am trying to create a contact using CDO 1.21. I was wondering if anyone had any sample code of how they may have done this. I am having trouble findinf documentation on how this is done. I would like to avoid useing outlook if possible and write directly to the exchange server if possible. Thanks Jerry.
3
1911
by: Jason | last post by:
Hi All I am not sure if this is the right place to post, but i would like to know... 1. CDO is just a wrapper for MAPI correct? 2. if someone wanted to use MAPI and CDO, you would have to install MS Office correct? Thanks Jason
1
2135
by: Rob | last post by:
Hi all, I have done a lot of researching on the above topic and the only think I now know for sure is that I have to use either CDO or MAPI. What I need to do is this: I want to write a C# desktop application that will connect to the exchange server and retrieve mail from an inbox. The features are as follows: 1) I need to be able to specify the URL of the server I am connecting to
4
5247
by: Noonan, Derek | last post by:
Hi all, I'm reposting this, as I feel that it may have got buried. If anyone can help me then I'd really appreciate it... I am trying to read information from the GAL using C#. I am able to return a list of all the addresses and names, however, when I walk through each address I cannot access the mailbox (I keep getting prompted for authentication information). Given that the long-term goal here is that the application run unattended...
5
3929
by: Siv | last post by:
Hi, A little while ago I asked if anyone could help me with how to create an email using MS Outlook that contained an embedded picture file. Thanks to Jay Harlow I was able to get this working using a code example from http://www.outlookcode.com/d/code/htmlimg.htm that details the procedure and with a bit of tweaking I managed to get it working really well. I now find that there is a new user on a laptop that always gets an error at...
0
3292
by: scanner36 | last post by:
I have a working VB6 program using MAPI and Outlook Express which sends and receives Email without problems. I am unable to send Email with attachments. I've tried most examples I've found online and although the code looks OK, I still end up with the Run Time error 32002 unspecified failure. Does MAPI work with attachments?
4
3518
by: Tarren | last post by:
Hi, All: I am tasked with the following. I need to write a service to monitor an Exchange mailbox and take action when an email is received, put it in a db, etc. I do not need to send emails through MAPI, only monitor a folder in exchange. Can I use .NET objects to do this or do I absolutely need a 3rd party add-in such as Outlook Redemption. This has to go on an enterprise production server, so the server group will fight me hard...
7
3490
by: Wiebe Tijsma | last post by:
Hi, I'm using C# + webDAV to create a draft message to be sent in a user's Drafts folder. I can create the message successfully, however when I open the message in outlook, it doesn't show the 'send' button, (only 'reply' etc as if it was a received message). I'm using exchange explorer to see the difference in webDAV properties
2
4279
by: =?Utf-8?B?RGF2aWRF?= | last post by:
Hi, I try to connect to Exchange server using MAPI. I need to access a special user inbox and read all his new mails. The code I wrote work good, but I get my inbox instead of the user I need. Here the code : MAPI.Session objSession; MAPI.Folder objFolder ;
0
9627
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10119
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9922
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8951
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5367
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5492
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4030
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2859
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.