Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8854943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:00:18+00:00 2026-06-14T14:00:18+00:00

I want to get currently selected embedded Attachment object when right-clicking on it in

  • 0

I want to get currently selected embedded Attachment object when right-clicking on it in context menu and clicking on custom button.

These are the steps I have done so far:

  • Added custom Button for ContextMenuInlinePicture ribbon context menu

    <customUI ...>
        <contextMenus>
        <contextMenu idMso="ContextMenuInlinePicture">
            <button id="SendInlinePictureToHbbButton"
                    label="Send to HBB"
                    onAction="OnSendInlinePictureToHbbButtonClick" />
        </contextMenu>
        </contextMenus>
    </customUI>
    
  • By right clicking on it I am calling my function OnSendInlinePictureToHbbButtonClick:

        public void OnSendInlinePictureToHbbButtonClick(IRibbonControl control)
    {
        var msg = "OnSendMailToHbbButtonClick \n\n";
        if (control.Context is Explorer)
        {
            msg = "Context=Explorer \n";
            var explorer = control.Context as Explorer;
            if (explorer.AttachmentSelection.Count >= 1)
            {
                msg += "AttachmentSelection \n";
                msg = explorer.AttachmentSelection
                    .Cast<Attachment>()
                    .Aggregate(msg, (current, attach) => current + attach.DisplayName + "\n");
            }
            else
            {
                var selection = explorer.Selection;
                msg += "MailItemSelection \n";
                if (selection.Count == 1)
                {
                    var olItem = new OutlookItem(selection[1]);
                    msg = msg + olItem.Subject + "\n" + olItem.LastModificationTime;
                }
                else
                {
                    msg = msg + "Multiple Selection Count=" + selection.Count;
                }
            }
        }
        MessageBox.Show(msg);
    }
    
  • When running add-in, I can see custom context menu item when right clicking embedded image/attachment.

enter image description here

  • After clicking on that button, above method is run, but I cannot get “AttachmentSelection”. Instead I get “MailItemSelection”.

enter image description here

  • How I can get Attachment object user is right clicking, so I can work with it?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:00:26+00:00Added an answer on June 14, 2026 at 2:00 pm

    I have contacted Microsoft via MSDN subscription incident resolution and they told me that this cannot be done.

    Attaching MS response:

    Hello Martin, I am from the Messaging Developer Support team and
    have now taken ownership of this case. I apologise for the delay, but
    my team currently has a very high workload and this is affecting our
    response times. I’ve had a look at the question as described at
    How can my Outlook add-in get the Attachment object the user is right-clicking in my custom menu?
    , and the simple answer is that it is not possible to do what you want
    to using the Outlook Object Model. Your code is doing what is
    expected, as you are querying the Explorer object for its selected
    items – and you are having the MailItem returned. This is the
    selected item in the Explorer object. There are no events/properties
    exposed by the preview pane, so it is not possible to determine which
    object is selected there. It would be possible to find all the inline
    attachments of the currently selected item if that would be helpful,
    but the functionality you are after is not available. Please let me
    know if you would like any further information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to get the currently selected item (text, image, etc) and display in
I'm trying to get the value currently selected and I simply want to alert
I have a normal dropdown which I want to get the currently selected index
think this should be an easy one... I want to get the currently selected
So I want to set the currently selected button to green background in a
How can I get the current selected row for UIPicker? I want to use
I'm using http://jqueryui.com/demos/tabs/#manipulation . I want to get an title of current selected tab
Every time I open a page I want to get the currently active project
I want to get the Height and Width of an Image.Currently what im doing
I want to get the second last item given to a shell program. Currently

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.