473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Using Outlook

Hi

I would like my vb app to work with outlook 2000 and above. What is the
method to get the appropriate reference(s) in my vb app?

Thanks

Regards

Nov 20 '05 #1
2 5067
Hi John,

Right-click on your Project (or the References just under it) in the
Solution Explorer and select "Add Reference..."

Click on the COM tab and go looking for Microsoft Outlook. Select this to
get it into the Selected Components box below. Hit Ok.

This will add the reference to the project.

Now, at the top.of the Form/Class/Module that will interact with Outlook,
add
Imports Outlook
Imports System.Runtime.InteropServices.Marshal

The first will provide access to Outlook The second is required for
releasing COM objects (which is what Outlook gives you).

To use Outlook, you'll need:

Dim oOutlook As Outlook.Application
'The Email source within Outlook.
Dim oMailStore As Outlook.NameSpace

oOutlook = New Outlook.Application
'oOutlook.ActiveExplorer.ShowPane (Outlook.OlPane.olFolderList, True)
oMailStore = oOutlook.GetNamespace ("MAPI")

oMailStore gets you the namespace of the InBox and Mail folders.
oMailStore.Folders will get you the folders themselves.
oMailStore.Folders.GetFirst will get you the first of these.

To finish off:

If Not g_oMailStore Is Nothing Then
oMailStore.Logoff()
ReleaseComObject (oMailStore)
oMailStore = Nothing
End If

If Not g_oOutlook Is Nothing Then
oOutlook.Session.Logoff()
ReleaseComObject (oOutlook)
oOutlook = Nothing
End If
That should get you started. :-)

Regards,
Fergus
Nov 20 '05 #2
John,
In addition to Fergus's example.

The following web site contains a plethora of information on using Outlook
from VB.NET.

http://www.microeye.com/resources/res_outlookvsnet.htm

Hope this helps
Jay

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Hi

I would like my vb app to work with outlook 2000 and above. What is the
method to get the appropriate reference(s) in my vb app?

Thanks

Regards

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: LEBRUN Thomas | last post by:
Hello :) I would like to use Outlook 2003 in my application so for that, i've added the referece to Outlook 11.0 Object Model to my project. Then, I try this simple code : using System;...
4
by: Max | last post by:
Hi, I would like to have a button and a combo box with options to select various versions of Microsoft Outlook: 2002, 2003. The user selects the email client and clicks the button. The only...
1
by: Michele | last post by:
Hi, I need to send the same Email to different people. I'm using Outlook XP and VB.Net. I tryed with the following code: Dim oOutL As Outlook.Application Dim oMail As Outlook._MailItem oOutL...
4
by: Nicole | last post by:
I found this code below to use to send emails using VB with Outlook. However, it gives these errors. 'Send' is ambiguous across the inherited interfaces 'Outlook._MailItem' and...
2
by: Ori :) | last post by:
I am writing an application to retrieve appointments from Outlook, I have the appointment items sorted by "Start" field and now I want to find the first record which's "Start" value is later than...
9
by: George McCullen | last post by:
I have an Outlook 2003 using Exchange Server 2003 Public Contacts Folder containing 20,000 Contacts. I am writing a VB .Net 2003 program that loops through all the contacts in a "for each oCt in...
5
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...
8
by: John Brock | last post by:
I am currently using a VB.NET program to send out e-mails with plain text bodies (plus one attachment). The emails are being received as Rich Text messages (probably just my personal Outlook...
3
by: bobdydd | last post by:
Hi Everybody Access 2000, Outlook 2000 Windows XP I am running the code below to open Microsoft Outlook from a Command Button. It works fine until I tried it on a machine that has Office...
1
by: mary mathews | last post by:
Hi, I'm getting an exception while tried to retrive an outlook contact using asp.net in a console application. The exception is as follows: An unhandled exception of type...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.