File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -195,13 +195,23 @@ async function onTypicalReplyButtonClicked() {
195195 }
196196 element . hidden = false ;
197197 if ( Office . context . mailbox . diagnostics ?. hostName === "Outlook" ) {
198+ // On Classic Outlook, Office.context.mailbox.item is always defined,
199+ // regardless of whether one or multiple messages are selected.
200+ // So we need to check the number of selected items to determine whether
201+ // it is single-select or multi-select.
198202 const selectedItems = await loadSelectedMails ( ) ;
199203 if ( ! selectedItems || selectedItems . length > 1 ) {
200204 await multiMailHandler ( buttonConfig ) ;
201205 } else {
202206 await singleMailHandler ( buttonConfig ) ;
203207 }
204208 } else {
209+ // On Classic Outlook, Office.context.mailbox.item is defined only when
210+ // a single message is selected.
211+ // singleMailHandler also requires Office.context.mailbox.item to fetch
212+ // the original mail data and to display the reply form. Therefore, when
213+ // Office.context.mailbox.item is undefined, the case must be handled by
214+ // multiMailHandler, which does not rely on Office.context.mailbox.item.
205215 const item = Office . context . mailbox . item ;
206216 if ( item ) {
207217 await singleMailHandler ( buttonConfig ) ;
You can’t perform that action at this time.
0 commit comments