A MailItem saved in the ItemSend Event is saved as draft - outlook

I'm developing an Outlook add-in that allows the user to save an email to the filesystem just after it's been sent.
To achieve this, I intercept the Application.ItemSend event, and inside my handler I call MailItem.SaveAs(...). It works, basically.
The problem I'm facing is that, when I open the file saved, the email is in draft state. I mean, the recipients, subject and message body can be modified, and the email can be resent. I want the email to be in "sent" state, i.e. not modifiable.
It looks like Outlook API does not provide any event dispatched after the email is sent. Only before, and this is my pain.
Do you have any idea to perform this?
Thanks a lot for your help!
Nico

the earliest you can save the message in the sent state and with the sender properties populated is when Items.ItemAdd event fires on the Sent Items folder.

Related

VSTO addon save files in ownCloud

I'm looking for a solution to send a file as an attachment to someone's email, the file is saved to ownCloud, and the recipient only receives a link to download the attachment in the body of the email.
Is it possible?
Yes, it is. You just need to handle the ItemSend event of the Application class which is fired whenever an Microsoft Outlook item is sent, either by the user through an Inspector (before the inspector is closed, but after the user clicks the Send button) or when the Send method for an Outlook item, such as MailItem, is used in a program.
In the event ItemSend handler you may extract the attached files and start uploading them to the webserver. You may cancel the process of sending the email and initiate it anew as soon as all files are uploaded. Before calling the Send method on the item you should paste the links for the uploaded files.

Create text/calendar type email that triggers accept/reject/ignore options

I can programmatically create an email with an .ics file attached. The email gets sent, the recipient clicks the .ics attachment to add it to their calendar. This is easily done.
I want to try and make Outlook behave a little different. When the user previews the message it detects that its calendar type and throws a prompt asking the user to take some action. This action decides if it gets pushed into the calendar. In a perfect world to have accept/reject/ignore options would be super sweet. Is it possible to construct/send and email in such a way that Outlook can treat it different from a standard email? E.G perhaps altering the type (CONTENT-TYPE:text/calendar)?
Note - I have seen a solution where the body contains a link to the .ics file informing the user about the calendar invite details. It then has a click here to Accept. This is nice because the .ics file does not have to be attached.
I am workign in VBScript/VBS world although Im not sure this is all that important. Has anybody done this is any sense. Is it even possible?
edited:
I ended up using the EASendMail component located here it has an autoCalendar property which works really well. It embeds the .ics file as a text/calendar and send the message as a text/calendar. The outcome is perfect, just like it was actually sent from the outlook. It previews with with the action buttons and even loads the meeting in Outlook at tentative waiting for action
Your email needs to follow a proper MIME structure for it to be recognized as an invitation. See Multipart email with text and calendar: Outlook doesn't recognize ics

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

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.

Mail add-in sent event

Is there a way to perform one final action right before an email is sent. I am making a Mail Add-in and I want to notify my application when the user sends the email. I am looking for a final state that let's my application know the user is finished composing their email.
For the COM addins, you can use Application.ItemSend event. For the web based addins, there is no such callback.

How to cancel appointment in Outlook?

I want show the Outlook cancellation form when an appointment is deleted via code in Delphi (program code, otherwise). I am able to delete an item which will delete the item from Outlook (please note the item does have recipient also). But I would like to show the cancellation form that Outlook uses when the user clicks on the Cancel Meeting button of the appointment item.
Is this possible?
Secondly, if this is not possible, then when the appointment is deleted via code (that is. appointment.Delete) I would like to send out the same cancel meeting email that outlook generates to each recipient. At the moment, when the appointment is deleted, even if there are recipient no email is sent.
Please help.
Set the MeetingStatus property to olMeetingCanceled and call Send. You can then delete the appointment.

Resources