ExplorerAttachmentSelectionChange event is missing

Add-in Express™ Support Service
That's what is more important than anything else

ExplorerAttachmentSelectionChange event is missing
 
Nevzat Hayri TAVUK?U




Posts: 30
Joined: 2019-12-19
I use ExplorerAttachmentSelectionChange and InspectorAttachmentSelectionChange. Result is incorrect when I select multiple folders.
Works correctly on the preview screen

User added an image
User added an image
Posted 17 Jan, 2020 09:17:18 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Nevzat,

I described this issue at https://social.msdn.microsoft.com/Forums/en-US/d9742e1f-4591-4e06-86db-3d63f155aabc/attachmentselection-may-return-0-despite-an-attachment-is-selected-in-the-ui?forum=outlookdev. What do you need to achieve? Can a Ribbon button added to the attachment context menu help?


Andrei Smolin
Add-in Express Team Leader
Posted 20 Jan, 2020 05:28:52 Top
Nevzat Hayri TAVUK?U




Posts: 30
Joined: 2019-12-19
I put a button in bottom reading pane. I want to get only selected attachment files from there.
Posted 20 Jan, 2020 05:58:15 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Here's a workaround based on my findings described on that page.

Add a Ribbon button to the attachment context menu. In the PropertyChanging event of that button, when Office asks you for the value of the the Visible property (if (e.PropertyType == ADXRibbonControlPropertyType.Visible); you always set e.Value = false thus making the button invisible), you get the context object (e.Context), cast it to the AttachmentSelection type, retrieve AttachmentSelection.Count and cache this value. When required, you return it.

See also section Updating ribbon controls at run time at https://www.add-in-express.com/docs/net-ribbon-components.php#properties-events.


Andrei Smolin
Add-in Express Team Leader
Posted 20 Jan, 2020 06:40:00 Top
Nevzat Hayri TAVUK?U




Posts: 30
Joined: 2019-12-19
I did this for the button on Ribbon. Is there any other way to do this in the form
Posted 20 Jan, 2020 07:21:56 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
You see the issue (AttachmentSelection.Count is zero) if you use a button on the form. To bypass the issue, use the workaround: add the Ribbon button to the Attachment context menu and use it as explained.


Andrei Smolin
Add-in Express Team Leader
Posted 20 Jan, 2020 07:25:18 Top
Nevzat Hayri TAVUK?U




Posts: 30
Joined: 2019-12-19
Thanks Andrei.
Posted 20 Jan, 2020 07:34:30 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
You are welcome!


Andrei Smolin
Add-in Express Team Leader
Posted 20 Jan, 2020 09:29:20 Top