473,583 Members | 3,386 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Outlook new mail code - getting exclamation marks when adding Microsoft Outlook Object Library

Hi,

I'm trying to code a application that can create a new email in Outlook
I have coded my project in VS 2003, but now I have upgraded to VS 2005.

I can not build my project anymore, I get a looooooong error. I can also
see, when I add a reference to my project, that the Microsoft.Offic e.Core
and the Outlook References have a yellow exclamation mark.

If I remove my reference to the Outlook object model, the code marked with a
"*" gives a error:
Error 1 The type or namespace name 'Outlook' could not be found (are you
missing a using directive or an assembly reference?)
C:\CSharp\Proje cts\C5Mailer\C5 Mailer\Program. cs 172 16 C5Mailer
My code snippet:
....
*public Outlook.Applica tion oApp;
*public Outlook._NameSp ace oNameSpace;
*public Outlook._MailIt em oMailItem;
*Outlook.Attach ment myAttach;

public Mail(string mailadr1, string mailbody1, string mailsub1,
string mailatt1, string skabelon)
{
oApp = new Microsoft.Offic e.Interop.Outlo ok.Application( );
oNameSpace = oApp.GetNamespa ce("MAPI");
oMailItem =
(Microsoft.Offi ce.Interop.Outl ook._MailItem)o App.CreateItem( Outlook.OlItemT ype.olMailItem) ;
oMailItem.To = mailadr1;
oMailItem.Subje ct = mailsub1;
if (skabelon.Equal s("nej"))
{
oMailItem.HTMLB ody = mailbody1;

}
else
{
StreamReader sr = new StreamReader(sk abelon,
Encoding.GetEnc oding("iso-8859-1"));
string htmlbody = sr.ReadToEnd();
sr.Close();
oMailItem.HTMLB ody = htmlbody;
}

myAttach = oMailItem.Attac hments.Add(mail att1, 1, 1, mailatt1);
....

Please help me on my way again. :)

Best regards
Mads
Sep 15 '06 #1
0 2001

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

Similar topics

2
19321
by: Fritz Switzer | last post by:
Can anyone provide a small snippet in C# that pulls out the Contacts in Outlook XP. I've seen a couple of examples in C++ and VB in previous newsgroup posts, but either the originals didn't work or my conversion skills are weak. And if I have to use tlbimp.exe what is the right file to use. Thanks for the help. -- Fritz
4
5092
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 things happening will be: a new email is created and some text is placed in the body, then the email window is displayed. The user can close the window or...
4
19297
by: John | last post by:
Hi Does anyone have a vb.net example of how to use redemption to send mail through outlook? Many Thanks Regards
5
3640
by: TM | last post by:
I would like to write a little app in Visual Basic .net as an add-in to Outlook 2003 so that I can quickly get a list of contact names and email addresses, then when I click on a name or email address, I want to open a new mail message to that person. I don't want to send the message, just open a new blank email so that I can make it easier...
10
2832
by: John | last post by:
Hi When I open a new outlook email from vb.net, sometimes outlook is very slow to appear or occasionally outlook freezes completely. I am targeting mixed office2000/xp environments so I am using the office2000 interop dlls generated by vs.net by adding office 2000 com reference. Any one else noticed this problem when targeting...
2
10513
by: Roger | last post by:
I am creating an application that will sit on a client pc and monitor the inbox. When an e-mail enters the inbox, then an even will be fired and I will then be able to process the mail. I have the following code that does fire the eventhandlerNewMail, but I don't know how to do the following 2 things... 1. Get the NewMail object so I...
8
2683
by: Li Pang | last post by:
Hi, I used following codes to pass a message item from CDO to Outlook. They worked fine when I used outlook 2000, but get an error of "Specified cast is not valid." when I used Outlook 2003. Anybody has an ideal? Dim outlookMsg AsMicrosoft.Office.Interop.Outlook.MailItem Dim adoMsg As MAPI.Message outlookMsg =...
26
4484
by: Tom Becker | last post by:
Is there a way, from Access, to programmatically click the Send and Receive button in Outlook?
1
4734
by: Marc | last post by:
Hello, Am getting acquainted with VSTO and Visual Studio. I have been really successful adding references to the PIAs for Word, Outlook, Excel, etc. to Console applications and VB applications. However, I also wanted to investigate add-ins (specifically for Outlook). I downloaded VBTO 2007 SE and installed it, and now when I start...
0
7821
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8172
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. ...
0
8320
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...
0
8190
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...
0
6577
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...
1
5697
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5370
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3841
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1152
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...

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.