Group:  Microsoft Outlook ยป microsoft.public.outlook.interop
Thread: Reference to the mailitem the user has chosen

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Reference to the mailitem the user has chosen
neoret[ at ]gmail.com 07.09.2006 10:51:58
Hi there :)

I have a button in Outlook which allows the user to save a mail item to
an external archiving system.

If the user presses this button I need to check wether or not he has a
mail-item "active". By this I mean that the user has selected a mail in
a spesific folder that he wants to archive.

Furthermore I need to get hold of that spesific mail item with
belonging attachements.

When reading in documentations, articles and examples I can only see
how you create folders and items - not how to get a reference to an
existing one.

I write my code in C#, and has a shared add-in. This button is
displayed in every office-application.

Thank's a lot for any contribution :)

Re: Reference to the mailitem the user has chosen
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 07.09.2006 14:29:16
ActiveExplorer is the active object in a folder view. Selected items in
ActiveExplorer are in the Selection collection. Once you have the item you
can access all its properties and its attachments.

Something like this:

private Outlook.Selection colSelect;
private Outlook.MailItem m_mail;

if (this.Application.ActiveExplorer() != Null)
{
colSelect = this.Application.ActiveExplorer().Selection;

try
{
m_mail = (Outlook.MailItem) colSelect[1];
// whatever
}
catch
{
}

// whatever
}

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


<neoret[ at ]gmail.com> wrote in message
news:1157626318.835124.48960[ at ]b28g2000cwb.googlegroups.com...
[Quoted Text]
> Hi there :)
>
> I have a button in Outlook which allows the user to save a mail item to
> an external archiving system.
>
> If the user presses this button I need to check wether or not he has a
> mail-item "active". By this I mean that the user has selected a mail in
> a spesific folder that he wants to archive.
>
> Furthermore I need to get hold of that spesific mail item with
> belonging attachements.
>
> When reading in documentations, articles and examples I can only see
> how you create folders and items - not how to get a reference to an
> existing one.
>
> I write my code in C#, and has a shared add-in. This button is
> displayed in every office-application.
>
> Thank's a lot for any contribution :)
>

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net