Reputation: 21
I am using an addin which enable me to attach a context menu to outlook attachments. So when ever I click on an attachment I am able to see my custom button in the context menu .
The problem I am facing is, how do I know which attachment is clicked. I have some alternatives in my mind
When context menu is opening, I can associate a tag to this context menu. In this tag , i can store the file name of the attachment. Using this file name I can identify the attachment in context_menu_button_click event. Currently I cannot find a place where context menu tells about the object, on which context menu was opened.
I loop through some property available in inspector or any other object which tell me which object, inside the email is selected. For this, I can get to the selected email and I can also iterate through all attachments, but I cannot figure out which attachment is selected (or right clicked)
Upvotes: 1
Views: 1226
Reputation: 66341
Use Explorer/Inspector.AttachmentSelection collection.
Upvotes: 0
Reputation: 21
Thanks to this SO post
var attachmentSelection = (control.Context as AttachmentSelection).OfType<Attachment>();
Which can be translated into...
AttachmentSelection attachmentSelection = control.Context as AttachmentSelection;
Now using attachmentSelection
object may solve the problem....!
Upvotes: 1