Outlook AddIn

P

Pete Davis

Using this as a guide:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q302896

I am trying to implement an AddIn for outlook using C#. The sample is in
VB.NET, so I assume this has to be possible in C# as well.

I've added references to the AddInDesignerObjects, Outlook, annd Office.

I have a class which has as a base class and implements the
IDTExtensibility2 interface, and this is where I run into problems. There
are 5 methods to implement. Here's an example of one:

public override void OnAddInsUpdate(ref System.Array Custom)
{
}

Now, according to the Object Browser, the base implementation is:

public abstract new void OnAddInsUpdate(ref System.Array custom);

But, for my implementation, I get the message: "no suitable method found to
override". But, if I change the signature of the method (change parameter
types, method name, etc), I get the error: "'MyAddin.MyAddIn' does not
implement interface member
'Extensibility.IDTExtensibility2.OnAddInsUpdate(ref System.Array)"

Any ideas on what's wrong here?

Thanks.

Pete
 
P

Pete Davis

An addtional note. It seems odd, but when I don't include the override, I
get no message whatsoever. I should get a message that I have to use "new"
or "override". If I don't include any of the methods, then I get an error
that they're not implemented. What's going on?

Pete
 
N

Nicholas Paldino [.NET/C# MVP]

Pete,

When I used the project wizard to create a new Office update, it gave me
this method:

public void OnAddInsUpdate(ref System.Array custom)

It used implicit interface implementation. You should be doing the same
thing, because you are not deriving from a base abstract class, but rather,
implementing an interface. Either that, or implement it specifically, like
this:

void Extensibility.IDTExtensibility2.OnAddInsUpdate(ref System.Array Custom)

Hope this helps.
 
K

Kalpesh Shah

The Add-In project, when generates code automatically, it adds

/// <summary>
/// Implements the OnAddInsUpdate method of the IDTExtensibility2 interface.
/// Receives notification that the collection of Add-ins has changed.
/// </summary>
/// <param term='custom'>
/// Array of parameters that are host application specific.
/// </param>
/// <seealso class='IDTExtensibility2' />
public void OnAddInsUpdate(ref System.Array custom)
{
}

So, just paste this method & provide your implementation.
Are you trying to hand-code each method that is exposed by the interface (IDTExtensibility2) ?

Kalpesh
 
P

Pete Davis

My mistake was not using the add-in project. I didn't realize it was there.
I was coding everything by hand. By using the add-in project, everything is
working beautifully now. Thanks for the help.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top