473,486 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Create 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.WriteLine( "Property '{0}' has changed in an Outlook Item", s )

//--------------------------------------------------------------------
public void FiddlingAroundWithOutlook(

//_Item is declared at class scope with: private Outlook.ContactItem _Item
_Item = (ContactItem)_Contacts.Items.Item(1)
_Item.PropertyChange += new Outlook.ItemEvents_10_PropertyChangeEventHandler( ChangeInOutlook )
This compiles without any problems but on execution produces this error message

An unhandled exception of type 'System.InvalidCastException' 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 1944

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

Similar topics

0
1403
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...
0
3772
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...
3
4083
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...
7
3250
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...
0
1114
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...
4
3000
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,...
4
12533
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...
5
3064
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...
1
1543
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...
0
7094
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
6964
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...
1
6839
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
7305
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...
0
5427
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,...
1
4863
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...
0
4559
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...
0
1378
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 ...
1
598
muto222
php
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.