In the code you disable the Reply and Reply to All actions on the first selected item which is a different item in both scenarios:
MailItem objMailItem = objSelectionList[1] as MailItem;
if (objMailItem != null)
{
objMailItem.Actions["Reply"].Enabled = false;
objMailItem.Actions["Reply to All"].Enabled = false;
}
But the displayed item is always the same, but it is not necessary the first in the collection. So, instead I'd suggest iterating over all selected items and disabling actions for all of them to make sure the view is updated correctly. A raw sketch:
for(int i=1; i <= objSelectionList.Count; i++)
{
MailItem objMailItem = objSelectionList[i] as MailItem;
if (objMailItem != null)
{
objMailItem.Actions["Reply"].Enabled = false;
objMailItem.Actions["Reply to All"].Enabled = false;
}
}
That is because the first item is not visible in the UI (Test 1
). In case of failures you can handle exceptions to suppress them and try on another item.