ClickEvents for Attachments

A

Asim Tozlu

Hi,

i search a click-event for the attachments in outlook 2007.

I want use VS 2005 SE for writing a PreviewHandle under outlook 2007.

thanks

asim
 
K

Ken Slovak - [MVP - Outlook]

Have you looked in the Object Browser at the item.BeforeAttachmentPreview
event? Or the other attachment events for any item? You should always check
in the Object Browser for any events, methods or properties you're looking
for.
 
A

Asim Tozlu

Hi Ken,

thanks.

Asim

Ken Slovak - said:
Have you looked in the Object Browser at the item.BeforeAttachmentPreview
event? Or the other attachment events for any item? You should always
check in the Object Browser for any events, methods or properties you're
looking for.
 
A

Asim Tozlu

Hi Ken,

i want try this:

public partial class ThisAddIn
{
private Outlook.AttachmentSelection _AttachmentSelection = null;
private Microsoft.Office.Interop.Outlook.ItemEvents_10 _events;

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
_events = (Outlook.AttachmentSelection)_AttachmentSelection;
_events.BeforeAttachmentPreview += new
Outlook.ItemEvents_10_BeforeAttachmentPreviewEventHandler(_BeforeAttachmentPreview);
}

private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}

private void
_BeforeAttachmentPreview(Microsoft.Office.Interop.Outlook.Attachment
_Attachment, ref bool cancel)
{
//look the extension of attachment in mail and work
}

#region Von VSTO generierter Code

/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert
werden.
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}

#endregion
}

But i have problems to find the events for BeforeAttachmentPreview. My idea
is, that the user click in Outlook2007 in his mail of the attachments. Now i
want read this attachment und see what the extension have it und then i
workt with them.

Thanks

Asim Tozlu
 
K

Ken Slovak - [MVP - Outlook]

The event you're looking for belongs to items, such as MailItem. You can't
just instantiate an event handler for BeforeAttachmentPreview without having
some item that fires that event. You probably should be instantiating a
class level Explorer object and handling the Explorer.SelectionChange()
event. That would let you know when one or more items are selected. Then you
can iterate the Selection collection and instantiate objects for each
selected item. It is on those items that you be handling
BeforeAttachmentPreview.

AttachmentSelection is also related to a specific item and can't just be
used generically for whenever one or more attachments are selected. You must
have an item instantiated that has those attachments and the
AttachmentSelection collection.
 

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