473,545 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Wiring an Outlook Event to a C# app

A warm, south pacific good morning to everyone

I posted this message on one of the other MSDN newsgroups (Messaging & Collaboration) and realised later that perhaps it wasn't the best choice. If I have transgressed a protocol which specifies posting to one newsgroup only then I can but offer my apologies. That said I still have the event wiring problem summarised below

I am developing a C# app that interfaces with Oulook. I need to be able to recognise when a PropertyChange event occurs in Outlook. I have attempted (unsuccessfully ) to wire this up using the following code

//--------------------------------------------------------------------
private void ChangeInOutlook (string s

Console.WriteLi ne( "Property '{0}' has changed in an Outlook Item", s )

//--------------------------------------------------------------------
public void FiddlingAroundW ithOutlook(

//_Item is declared at class scope with: private Outlook.Contact Item _Item
_Item = (ContactItem)_C ontacts.Items.I tem(1)
_Item.PropertyC hange += new Outlook.ItemEve nts_10_Property ChangeEventHand ler( ChangeInOutlook )
This compiles without any problems but on execution produces this error message

An unhandled exception of type 'System.Invalid CastException' occurred in interop.outlook .dl
Additional information: No such interface supporte

Just in case you may be wondering, ...Items.Item(1 ) returns a valid ContactItem
Can anyone give me a steer please on what I'm doing wrong here

Many thank
Plume

Nov 16 '05 #1
0 1946

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

Similar topics

0
1412
by: Chris Fink | last post by:
I am writing a c# unattended windows application and I would like to write an event to handle any type of application error by gracefully degrading and writing a message to an error log. Errors should never be visible or pause program execution, in case of an error program should just exit and write error to logfile. I would like to...
0
3779
by: Martin Knauer | last post by:
Hi, I try to build an Outlook Plugin. After having some trouble with the Inspectorevents I'm trying to build a wrapper for the Inspectorclass. However I'm stuck again after letting VS.Net 2003 create the stubs for the Inspector-Interface. When I try to compile the new Wrapperclass it says
3
4093
by: Robert W. | last post by:
I have several instances where I wire up an event handler like this: // Instantiate object childClass parentObject = new childClass(); // Wire up event parentObject.SomeChildEvent += new EventHandler(ParentEventHandler);
7
3255
by: Oisin Grehan | last post by:
Hi, I have a UserControl derived class: <ns:votingbutton runat="server" id="btn1" onclick="votingbuttonclick" /> My question is, what code do I need in place in the codebehind for this to be wired up? All the examples I've seen wire up the event programatically, thus making this declarative attribute irrelevant. e.g.
0
1122
by: Homam | last post by:
To wire a Click event handler to a dynamically-added control (e.g. LinkButton), you need to do so during the Load event of the parent (e.g. a PlaceHolder). The problem is, the Click event handler sets up a member variable that needs to control how the dymanic controls are created in the first place! Alas, I can't do so because it's...
4
3008
by: Jordan | last post by:
I need to dynamically add an ImageButton control to a user control and and do some server-side processing when the user clicks it. While I the ImageButton is added to the user control at runtime, as needed, I'm having trouble wiring up its click event procedure. The problem is that when I go to subscribe the ImageButton to the delegate, the...
4
12539
by: Tomasz | last post by:
Hello Developers, Here is interesting problem I just came across: how do I wire a GridView control programmatically? Here is my sample code using Object Data Source: protected void Page_Load(object sender, EventArgs e) { ObjectDataSource ods = new ObjectDataSource("MyTestTableAdapter",
5
3067
by: Andrew Robinson | last post by:
I have a page that can load a number of different user controls. Each of these user controls inherits from a common base class and the controls are loaded based on application state, status, etc and the specific type of control frequently changes. I have a common event in the base class that each child user control inherits from and that the...
1
1549
by: spoonybard | last post by:
Hi Everyone, Recently, when I was trying to wire up an event for a GridView inside an AJAX Accordion, I was doing the wiring up in the code behind. The event never fired. When I moved that declaration into the HTML markup, the event fired and worked properly. Just today I experienced the same thing with attempting to wire up an event for a...
0
7486
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...
0
7416
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
7932
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...
1
7442
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...
0
6001
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
5347
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
4965
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
3456
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.