473,782 Members | 2,498 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Outlook 2003 Object Model using Visual C# 2005 Express IDE Beta1

Following an intro article from the msdn homepage about using C# to access
the Outlook 2003 Object Model in Applications and Add-Ins, I came across a
problem with the OPine example.

I was reading through the article on the C# msdn home page about introducing
the Outlook 2003 Object Model through C#.

I carefully programmed the OPine example, but after ironing out reference
errors and syntax, etc., I finally had this one annoying error. I can see
obviously what is causing it (two methods with similar names is my guess),
but for the life of me can't figure out how to fix it! The code is EXACTLY as
out of the article...

Error:
Error 1 Ambiguity between
'Microsoft.Offi ce.Interop.Outl ook._MailItem.S end()' and
'Microsoft.Offi ce.Interop.Outl ook.ItemEvents_ 10_Event.Send'
C:\Documents and Settings\rcleme nts\Local Settings\Applic ation
Data\Temporary Projects\OPine\ Program.cs 122 19

Here is the code reference:
public static void SendNewMail(App licationClass o)
{
// Create a new MailItem.
MailItem myMail =
(MailItem)o.Cre ateItem(OlItemT ype.olMailItem) ;
// Now gather input from user.
Console.Write(" Receiver Name: ");
myMail.Recipien ts.Add(Console. ReadLine());
Console.Write(" Subject: ");
myMail.Subject = Console.ReadLin e();
Console.Write(" Message Body: ");
myMail.Body = Console.ReadLin e();
// Send it!
myMail.Send();
}

It is the method Send() in the last line of the static method which causes
the error...

Can anyone help me compile this? How can I force it to choose the correct
option?

Will
Nov 16 '05 #1
3 5307
(myMail as Outlook._MailIt em).Send();

Willy.

"WillShakespear e" <Wi************ *@discussions.m icrosoft.com> wrote in
message news:CC******** *************** ***********@mic rosoft.com...
Following an intro article from the msdn homepage about using C# to access
the Outlook 2003 Object Model in Applications and Add-Ins, I came across a
problem with the OPine example.

I was reading through the article on the C# msdn home page about
introducing
the Outlook 2003 Object Model through C#.

I carefully programmed the OPine example, but after ironing out reference
errors and syntax, etc., I finally had this one annoying error. I can see
obviously what is causing it (two methods with similar names is my guess),
but for the life of me can't figure out how to fix it! The code is EXACTLY
as
out of the article...

Error:
Error 1 Ambiguity between
'Microsoft.Offi ce.Interop.Outl ook._MailItem.S end()' and
'Microsoft.Offi ce.Interop.Outl ook.ItemEvents_ 10_Event.Send'
C:\Documents and Settings\rcleme nts\Local Settings\Applic ation
Data\Temporary Projects\OPine\ Program.cs 122 19

Here is the code reference:
public static void SendNewMail(App licationClass o)
{
// Create a new MailItem.
MailItem myMail =
(MailItem)o.Cre ateItem(OlItemT ype.olMailItem) ;
// Now gather input from user.
Console.Write(" Receiver Name: ");
myMail.Recipien ts.Add(Console. ReadLine());
Console.Write(" Subject: ");
myMail.Subject = Console.ReadLin e();
Console.Write(" Message Body: ");
myMail.Body = Console.ReadLin e();
// Send it!
myMail.Send();
}

It is the method Send() in the last line of the static method which causes
the error...

Can anyone help me compile this? How can I force it to choose the correct
option?

Will

Nov 16 '05 #2
Brilliant Willy, thanks!

If you have time, any chance you could explain why this happens? And if I
should look out for similar problems? I ask becaus ethe examples were for
VS.NET 2003, which I have, but was trying out the Beta Express version. Is it
likely a bug, maybe?

I would assume that as the article was written for 2003, then likely this
problem doesn't happen, you see, as I would be surprised if the code was not
tested before publication (well, maybe "surprised" isn't the right word...
maybe irked is better!).

Will

"Willy Denoyette [MVP]" wrote:
(myMail as Outlook._MailIt em).Send();

Willy.

"WillShakespear e" <Wi************ *@discussions.m icrosoft.com> wrote in
message news:CC******** *************** ***********@mic rosoft.com...
Following an intro article from the msdn homepage about using C# to access
the Outlook 2003 Object Model in Applications and Add-Ins, I came across a
problem with the OPine example.

I was reading through the article on the C# msdn home page about
introducing
the Outlook 2003 Object Model through C#.

I carefully programmed the OPine example, but after ironing out reference
errors and syntax, etc., I finally had this one annoying error. I can see
obviously what is causing it (two methods with similar names is my guess),
but for the life of me can't figure out how to fix it! The code is EXACTLY
as
out of the article...

Error:
Error 1 Ambiguity between
'Microsoft.Offi ce.Interop.Outl ook._MailItem.S end()' and
'Microsoft.Offi ce.Interop.Outl ook.ItemEvents_ 10_Event.Send'
C:\Documents and Settings\rcleme nts\Local Settings\Applic ation
Data\Temporary Projects\OPine\ Program.cs 122 19

Here is the code reference:
public static void SendNewMail(App licationClass o)
{
// Create a new MailItem.
MailItem myMail =
(MailItem)o.Cre ateItem(OlItemT ype.olMailItem) ;
// Now gather input from user.
Console.Write(" Receiver Name: ");
myMail.Recipien ts.Add(Console. ReadLine());
Console.Write(" Subject: ");
myMail.Subject = Console.ReadLin e();
Console.Write(" Message Body: ");
myMail.Body = Console.ReadLin e();
// Send it!
myMail.Send();
}

It is the method Send() in the last line of the static method which causes
the error...

Can anyone help me compile this? How can I force it to choose the correct
option?

Will


Nov 16 '05 #3

"WillShakespear e" <Wi************ *@discussions.m icrosoft.com> wrote in
message news:94******** *************** ***********@mic rosoft.com...
Brilliant Willy, thanks!

If you have time, any chance you could explain why this happens? And if I
should look out for similar problems? I ask becaus ethe examples were for
VS.NET 2003, which I have, but was trying out the Beta Express version. Is
it
likely a bug, maybe?

I would assume that as the article was written for 2003, then likely this
problem doesn't happen, you see, as I would be surprised if the code was
not
tested before publication (well, maybe "surprised" isn't the right word...
maybe irked is better!).

Will


I don't think it's a bug, apparently the C# compiler team decided to flag an
error when he encounters an object that has an event and a method with the
same name, something they silently resolved in v1.x. You can get around this
issue by an explicit cast to the correct interface (or by using vb.net ;-),
like this:

(myMail as Outlook._MailIt em).Send();
or
( (Outlook._MailI tem)myMail ).Send();

Willy.
Nov 16 '05 #4

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

Similar topics

7
5416
by: MLH | last post by:
Is the following remotely correct? =DDE("C:\Program Files\Program Files\Outlook Express\OEmig50","Attachment","Name") I'm not sure that OEmig50.exe is the executable for OE. Anybody know? I find no list of TOPICS to use with the DDE related commands in Access Basic or VBA
6
5368
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; using Microsoft.Office.Interop.Outlook;
0
309
by: WillShakespeare | last post by:
Following an intro article from the msdn homepage about using C# to access the Outlook 2003 Object Model in Applications and Add-Ins, I came across a problem with the OPine example. I was reading through the article on the C# msdn home page about introducing the Outlook 2003 Object Model through C#. I carefully programmed the OPine example, but after ironing out reference errors and syntax, etc., I finally had this one annoying error....
9
6745
by: Srinivas | last post by:
hi all how to access the outlook user profiles through VB.net any help.... thanks in advanc Srinivas
1
1614
by: Rohan | last post by:
Hi There, I want o access address book of OUTLOOK EXPRESS on Web Clients PC so that he can select addresses from his address book & copy them to our database. Does Outlook Express support an object model? if yes where do I get help on it. If No ? How do I achieve this task? pls help
9
4974
by: Neil | last post by:
We have an Access 2000 MDB with a SQL 7 back end. We are upgrading SQL Server to SQL 2005, and are considering upgrading to Access 2003. Someone mentioned that they had heard about some incompatibilities between Access 2003 and SQL Server 2005. Anyone hear of anything? And, if so, would staying with Access 2000 be better? Thanks! Neil
2
2451
by: Pieter | last post by:
Hi, I'm using a thight integration with Outlook 2003 (with an Exchange server) in my VB.NET (2005) application. Until now I'm using the Outlook Object Model, but it appears to be very slow, and has some problems: - doing a Move changes the ReceivedTime of the MailItem - I can't use RichText in the MailItem.Body (only allows plain text or HTML) - some other stuff like having to use small 'tricks' to show the default signature in an email
0
4775
by: toduro | last post by:
Using Visual C# 2005 Express Edition and Microsoft Office Outlook 2003. An exception with message: "Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 8007007e" is thrown during processing of the statement: "Microsoft.Office.Interop.Outlook.Application outlook_app = new
3
2057
by: ITrishGuru | last post by:
Hi all, For my IT final year project I have to access mail items in outlook 2003 and parse them. I have read and researched on the net and library for about a week now. I have to do the project in c# using visualc# 2005 Express Edition. I know this may limit me to manully coding a little more but I dont mind that. So far I think I have to create a COM adddin and communicate via
5
2423
by: fniles | last post by:
I am using VB.NET 2005. I created a project using the Microsoft Outlook 8.0 Object Library (Object Model) in my previous machine. Now that I have a new machine, when I try to compile that program in the new machine, it gives me erros like "Type 'Outlook.Application' is not defined", "Type 'Outlook.NameSpace' is not defined". I have MS Outlook in my new machine. In the new machine when I go to "Add Reference", select the COM tab, the only...
0
9641
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
10146
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...
1
10080
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7494
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5378
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
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
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
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.