AttachmentSelection 2016 x64

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

AttachmentSelection 2016 x64
Outlook 2016 Explorer & Inspector AttachmentSelection.Count in 64 bit is always 1 
Axpoint




Posts: 9
Joined: 2013-10-31
Hello!

I have a peculiar issue with the count of and selection of attachments in Outlook 2016 x64, where it always only contains the first attachment selected.

I have noticed that in the 32 bit version of 2016, the context is "AttachmentSelection" whereas in the 64bit version it has changed to "Explorer" (in explorer) and "Inspector" (in the inspector). This might seem fine, however when going through the selection in the explorer or inspector, it only contains the first selected attachment and not the rest.

In 32bit:
[img]http://imgur.com/4ar9a1N[/img]
[img]http://imgur.com/3rBULYB[/img]

In 64bit:
[img]http://imgur.com/yPVi5zR[/img]
[img]http://imgur.com/9tmf7pQ[/img]

This is the code:
object context = control.Context;
if (context is Outlook._Explorer)
{
	MessageBox.Show("EXPLORER");
	Outlook._Explorer window = context as Outlook._Explorer;
	MessageBox.Show("Count: " + window.AttachmentSelection.Count);
	GetAttachmentsInfo(item, window.AttachmentSelection);
	Marshal.ReleaseComObject(window.AttachmentSelection);
}
else if (context is Outlook._Inspector)
{
	MessageBox.Show("INSPECTOR");
	Outlook._Inspector window = context as Outlook._Inspector;
	MessageBox.Show("Count: " + window.AttachmentSelection.Count);
	GetAttachmentsInfo(item, window.AttachmentSelection);
	Marshal.ReleaseComObject(window.AttachmentSelection);
}
else if (context is Outlook._AttachmentSelection)
{
	MessageBox.Show("ATTACHMENTSELECTION");
	Outlook._AttachmentSelection attSelection = context as Outlook._AttachmentSelection;
	MessageBox.Show("Count: " + attSelection.Count);
	GetAttachmentsInfo(item, attSelection);
	Marshal.ReleaseComObject(attSelection);
}


Any ideas to how to get the correct attachmentselection in Explorer and Inspector in both 32 and 64 bit?
Posted 17 Mar, 2016 07:58:03 Top
Andrei Smolin


Add-in Express team


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

Install all updates on Office 2016 64bit.



Andrei Smolin
Add-in Express Team Leader
Posted 17 Mar, 2016 08:54:52 Top
Axpoint




Posts: 9
Joined: 2013-10-31
Already done.
Posted 17 Mar, 2016 09:08:11 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Does the issue persist? If yes, what Outlook build do you have in File | Office Account | About Outlook?

Axpoint writes:
MessageBox.Show("Count: " + window.AttachmentSelection.Count);
GetAttachmentsInfo(item, window.AttachmentSelection);
Marshal.ReleaseComObject(window.AttachmentSelection);


Also note that *every* window.AttachmentSelection call above creates a new instance of the COM object. You release the last of them, but leave unreleased another two instances.



Andrei Smolin
Add-in Express Team Leader
Posted 17 Mar, 2016 09:13:07 Top
Axpoint




Posts: 9
Joined: 2013-10-31
Ah I can see that the version 16.0.4312.1000 is not the latest (which is what the computer is using) and the IT department is in charge of updates, so I will have to talk to them...

In regards to releasing, this is just at snippet, and the context is released after execution :)

I will get back to you when I have forced the IT-PRO's to update.

Regards,
Axpoint
Posted 17 Mar, 2016 09:16:39 Top
Axpoint




Posts: 9
Joined: 2013-10-31
I have tested the solution on a 64-bit Outlook 2016 version 16.0.6568.2036 and it now identifies the selection as an AttachmentSelection again.

Sorry to have wasted your time, however I guess this thread proves that it doesn't work on earlier versions.

Thanks.

Regards,
Christian
Posted 17 Mar, 2016 11:11:42 Top
Andrei Smolin


Add-in Express team


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


Andrei Smolin
Add-in Express Team Leader
Posted 18 Mar, 2016 02:24:54 Top