Closed ghelyar closed 1 year ago
We consider meeting requests (such as the form created when forwarding an appointment) as Messages, so that's why we trigger the OnNewMessageCompose event. We will make that clear on our documentation page. If you believe we should separate meeting requests from the message category, please let us know by submitting a feature request to our Tech Community page: https://aka.ms/M365dev-suggestions. We consider these requests during our planning process.
The behaviour is at least inconsistent between versions of outlook, and between new, reply and forward.
We have implemented fixes to ensure the current behavior based on the scenarios provided by customers. This means that the behavior in the latest builds is the expected one. I just tried Is there any particular difference/inconsistency you want to mention here?
Can you describe the scenario you are trying to accomplish?
With the following event-based add-in based on https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/autolaunch?tabs=xmlmanifest
function onNewMessageComposeHandler(event) {
console.log("OnNewMessageCompose");
Office.context.mailbox.item.from.getAsync((fromResult) => {
Office.context.mailbox.item.body.setSignatureAsync(
"OnNewMessageCompose: " + fromResult.value.emailAddress,
{ coercionType: Office.CoercionType.Html },
() => event.completed()
);
});
}
function onNewAppointmentComposeHandler(event) {
console.log("OnNewAppointmentOrganizer");
Office.context.mailbox.item.from.getAsync((fromResult) => {
Office.context.mailbox.item.body.setSignatureAsync(
"OnNewAppointmentOrganizer: " + fromResult.value.emailAddress,
{ coercionType: Office.CoercionType.Html },
() => event.completed()
);
});
}
The results I get are | Outlook Web | Outlook desktop (Windows) | |
---|---|---|---|
New message | OnNewMessageCompose (from: self) | OnNewMessageCompose (from: self) | |
Reply message | OnNewMessageCompose (from: self) | OnNewMessageCompose (from: self) | |
Forward message | OnNewMessageCompose (from: self) | OnNewMessageCompose (from: self) | |
New meeting/event | OnNewAppointmentOrganizer (from: self) | OnNewAppointmentOrganizer (from: self) | |
Reply meeting/event | OnNewMessageCompose (from: self) | OnNewMessageCompose (from: self) | |
Forward meeting/event | Sometimes nothing, sometimes OnNewMessageCompose (from: self) | OnNewMessageCompose (from: on behalf) |
OnNewMessageCompose
event is run, but the from address is the address of the original meeting organiser (the send on behalf address). OnNewMessageCompose
event is triggered with the normal from address of the logged in userThe scenario we weren't expecting is that on Outlook desktop on Windows, forwarding meetings that were originally created by a user outside of the organisation causes the from address to be a different user to the SSO token's user. In our case, this causes our back end to return a 403 error, and the only thing we can do is try to show the user a friendly error message saying that they aren't allowed to access resources for the original meeting organiser, but this is confusing to users because they weren't trying to - they expect their own resources.
I would ideally like it to be consistent across all platforms, and ideally to be able to differentiate the from/sender/send on behalf.
Office.context.mailbox.userProfile.emailAddress
exists, but this is not the address that we want to use, because the thing we're doing is specific to the from address (e.g. when a user has proxy addresses, a UPN, etc, we want it to be specific to the one they are using to send the email).
@ghelyar thanks for the detailed response with your tests around from/sender/send on behalf of. Apologies for the delay in getting back to you. I'm able to reproduce the inconsistency with from
when forwarding a meeting/event. I have created a tracking item on our backlog. We unfortunately have no timelines to share at this point.
Internal tracking ID : Office 7324963
This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!
Don't close
We have fixed this issue and the fix should be available in build 16.0.16201.10000 or later. When an updated build is available depends on the release channel a customer is on.
outlook desktop and outlook web - While forwarding meeting invite web add-in popup are not coming in (Office version number: Version 2308 and build 16731.2). My office Add-in is based on the email send event. We open a dialog to perform a few activities before sending an email. More details :- Platform [PC desktop, Mac, iOS, Office on the web]: PC desktop - Outlook Desktop (both old and new versions) and outlook Web Host [Excel, Word, PowerPoint, etc.]: __ Office version number: Version 2308 and build 16731.2 Operating System: Window 11 Browser (if using Office on the web): Yes
Steps to replicate:-
Provide required information needed to triage your issue
Your Environment
Expected behavior
OnNewMessageCompose
should not be triggered on forwarding a meeting invite (maybe an*Appointment*
event should be instead, but that's not necessary for our use case)Current behavior
On Outlook desktop for Windows, if you forward a meeting invite, you get an
OnNewMessageCompose
event triggered.The mail item has nothing on it that can differentiate it from a normal message
The
from
address on the mail item is the send on behalf address.The
itemType
ismessage
, notappointment
.Appointment fields like
organizer
are all undefined.On Outlook for Web, this event is not triggered.
Steps to reproduce
OnNewMessageCompose
launch eventsetSignatureAsync
Context
We are not interested in meetings/appointments, but there doesn't seem to any way to filter these out.
As the
from
address is the send on behalf address, our add-in does not function correctly on these forwarded meeting invites. As it acts as if the address that sent the original meeting is in the from address, for internal meetings the add-in runs its actions for the wrong address, and for external meetings the add-in fails auth to our back end because the address does not belong to the same tenant as the SSO token.