How to listen an MailItem event in Mail Add-in? - outlook

I want to detect an event in Mail Add-in. In Outlook, thick/desktop version, we can detect the mail event, such as MailItem.Send and MailItem.AttachmentAdd.
Is it possible to listen to these events in Outlook online?

Unfortunately there are almost no events of any kind in the Mailbox API, other than asynchronous callbacks that are only fired when you initiate them. There is nothing that I'm aware of that can be used to detect item send or attachment modification events.
The closest option is to use the Outlook Notifications REST API (https://msdn.microsoft.com/office/office365/APi/notify-rest-operations), but these are more suitable to monitoring item/folder level changes. Perhaps you can hook into a notification for the Sent Items folder to approximate a MailItem.Send operation, or watch changes to a draft item to detect a newly added attachment.

nop. you can't do this. Office Apps can't interact with buttons or actions on the client apps such as: Outlook.

Related

Dismissing Outlook reminders triggers MS Graph API event change notification and ChangeKey change, any way to avoid?

My app keeps track of users' calendar events via Microsoft Graph API. My database records each synced event's ChangeKey, which helps my app determine whether a event has changed and should be processed by business logic.
I also subscribe to the change notification API so that my app doesn't have to poll often.
What I found out lately is that whenever the user dismisses an event's "reminder" via Outlook (via the Outlook reminder popup), which is a very common thing to do as Outlook puts all calendar events on reminders automatically, the Graph API would send out change notification on that event.
That would have been fine – except that the event's ChangeKey actually changes, even though nothing material about the event has changed (date times/subject/body etc). Since my app uses the ChangeKey property to compare events, the business logic triggers unnecessarily.
Is this normal behavior and doesn't that nullify the practical purpose of ChangeKey? Is there any workaround other than giving up the use of this property, and instead manually check for the equality of each meaningful field for event equality?

Outlook add in OnSend event to trigger only for appointments, not emails

Currently I am developing an Add in for Outlook and I have implemented onSend event. Since it is UI-less and it is always triggered, I was wondering is there a way to only trigger it for Appointments not emails? This is because user experience, for them not to have "Add in" triggered when messages are created and sent out.
There isn't a way to restrict On-send to just appointments. One workaround, which I'm sure you are aware of, is to no-op the event handler if the item is a message. This doesn't solve the problem of the add-in running on messages.
We track Outlook add-in feature requests on our Tech Community Page. Please submit your request there and choose the appropriate label(s). Feature requests on Tech Community are considered, when we go through our planning process.

Outlook web add in before send and before delete events

I need to send data (body, location and etc.) from the appointment to my server after the user clicks on Send and Delete button.
I find solution for "Send" event in documentation.
Are there any other hooks for Send event and can I catch Delete event in Outlook web add in?
Thanks.
The only hook for the Send event is the On-Send feature you linked above. Currently, we don't have a hook for the Delete event. We track Outlook Add-in feature requests on our user-voice page. Please add a request there. Feature requests on user-voice are considered when we go through our planning process.

How to send appointment through Outlook add-in?

I'm trying to implement an add-in for Outlook which has some fields and a button that once clicked does some validations and sends an appointment to inform the attendees.
I am using the function below to achieve my goal:
Office.context.mailbox.item.saveAsync()
Office.context.mailbox.item.close() (as a callback for the function above)
It works for office365, but it doesn't work for office365 thick client.
I found in the Microsoft docs that with the function 'saveAsync' in Outlook in cached mode, the item is saved to the local cache. I disabled this option and still getting the same result.
I was using OnSend functionality, but this feature is not supported for Outlook client.
Any advice or tips of how could I have the functionality of sending the appointment through my Add-in in both, client and web version of Outlook? Basically I need to trigger the existing button 'Send' in the calendar.
It sounds like the ItemSend Event (OnSend) you are using in Outlook on the Web handles your scenario. We are working to bring this functionality to Outlook on Windows soon.

Delay emails sent and received through IMAP

I want to put emails the user receives in a sort of "review status" in my app and let users choose manually if they want them to be let through.
For this I need to filter network traffic to withhold emails receivef with the IMAP protocol from Outlook and send them some time afterward. And to the same for emails being sent.
Would this be possible to do on Outlook on Windows 7/8? Or would I be unable to make Outlook receive the mailing after I filter it out?
The Outlook object model doesn't provide anything for foltering emails.
Instead, you may consider handling the new email programmatically in the code handling the NewMailEx event which is fired when a new item is received in the Inbox. For example, you may develop a VBA macro for doing any customizations in Outlook programmatically. See Getting Started with VBA in Outlook 2010 for more information.

Resources