Can I override the default "Drag and Drop" behaviour when dragging email item from outlook? - outlook

After dragging email item from outlook, my own application (written in C#) can get the data and retrieve the msg data when the email item is dropped on it. But is it possible to override the default "drag and drop" behavior so that I can send some information else (rather than the default information) when dragging an email item and pick up the information when the item is dropped on my own application?

No - there might be some very ugly hacks, but no usable approach.
What you could do though is utilize something from the mail in information you receive via Drag'n'Drop as a unique identifier somewhere in the mail information that gets transmitted.
With the ability to identify the mail in Outlook you could e.g. connect to Outlook via automation or use a minimal Outlook AddIn that can be queried for what you need.

Related

On-send add-in not loading after Outlook error

I am developing an Outlook 'on-send' add-in which loads a dialog box if the email is addressed to multiple recipients after the send button is pressed. In the dialog, the user confirms the intended recipients from a list and then presses send. The add-in then allows the send event to happen.
A problem arises if the emails are not formatted correctly; Outlook throws a ‘does not recognise email’ error after trying to send the email. The problem is that when I try to send the email again after the error, the add-in does not load. The add-in should load every time the user tries to send an email to multiple recipients.
Please see a video of this behaviour here: https://youtu.be/U1VFuy1qbHM
As you can see from the video, the email goes to my Outbox fine after the first send. However, Outlook throws an errors when I edit the email in my Outbox and try to send it again (presumably because I was using a made up email to test with). As you can see, if I then update the emails and click send, the email sends without the add-in loading again. The intended functionality of the add-in is that another dialog box should be displayed in this case.
This behaviour also occurs when you reply to an email where the recipient has their email address formatted differently. For example, 'Name Surname (name.surname#domain.com)' instead of 'Name Surname <name.surname#domain.com>'. Outlook does not seem to like this format and throws a similar error after trying to send the email. After updating the email format and clicking send, the add-in does not load again.
The error occurs in Win32.
I do not think the problem is with the Javascript. I think the add-in does not even load when I try to resend the email. Maybe the add-in is somehow holding onto the ‘True’ value of the on-send event from the previous dialog box? I have tried editing the different ‘ReadorEdit’ values in the Manifest file to try and ensure the add-in loads for all cases but it has not helped.
What can I do to ensure the add-in loads after these errors?
Thank you for your help- it is very much appreciated.

Add information message when reading email

I would like to display an information message for the user when he read a specific email (i.e the email is tagged as external). The message should be displayed in the same way as outlook categories.
I know that I can use Exchange transport rule to achieve that but my client don't want to modify the message itself. He prefers displaying a message in the UI without changing the email body. The other option is to use the Office.context.mailbox.item.notificationMessages interface but as I told, I don't want to modify the email item if possible.
Do you think it is doable with outlook JS addins ?
My need is similar to this one for VSTO addin: How can my Outlook VSTO Add-in modify the read email form?
The Office.context.mailbox.item.notificationMessages interface provides the addAsync method which accepts the JSONMessage parameter which represents a JSON object that contains the notification message to be added to the item. It contains a NotificationMessageDetails object. Among properties you can find the persistent property which specifies if the message should be persistent. Only applicable when type is InformationalMessage. If true, the message remains until removed by this add-in or dismissed by the user. If false, it is removed when the user navigates to a different item. For error notifications, the message persists until the user sees it once. Specifying this parameter for an unsupported type throws an exception.
In case of categories, the message will be modified.
Do you know if it's possible to execute the function as soon as the read form is opened without having to click on an action button ?
Web add-ins are run under the context of currently selected item only. You can pin a task pane, then you'll be able to register an event handler to get notified of the change. The event handler should accept a single parameter, which is an object literal. The type property of this object will be set to Office.EventType.ItemChanged. When the event is called, the Office.context.mailbox.item object is already updated to reflect the currently selected item.
Office.initialize = function (reason) {
$(document).ready(function () {
// Set up ItemChanged event
Office.context.mailbox.addHandlerAsync(Office.EventType.ItemChanged, itemChanged);
});
};
function itemChanged(eventArgs) {
// Update on the new current item
}
Currently the event-based activation of add-in in Read mode is not supported. 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.
Currently, Event-based of activation of add-ins is only supported for Compose mode. You can explore more here- Configure your Outlook add-in for event-based activation - Office Add-ins | Microsoft Docs

Outlook New Message - Text Area Below Toolbar

I am creating an addin for Outlook.
I want to check some text on sending, but im not sure how to reference it
The text is in the image below and says “Attachment will be sent using...”
If the text equals the text displayed, i want to do something.
Thanks for any advice.
The Outlook object model doesn't provide anything for reading mail tips. But you may consider using EWS for getting mail tips. See Using MailTips in EWS to get the OOF (Out of Office) Status of users with C# and Powershell for the sample code.
FYI MailTips are informative messages displayed to users in the infobar in Outlook Web App and Outlook 2010/2013/2016 when a user does any of the following while composing an e-mail message:
Add a recipient
Add an attachment
Reply or Reply all
Open a message from the Drafts folder that's already addressed to recipients
To configure MailTips for mailboxes, external contacts, and distribution groups, in the Exchange Control Panel, select the mailbox, external contact, or distribution group, click Details, and then in the MailTip section, create the MailTip.
To configure MailTips for mail users and dynamic distribution groups, in Windows PowerShell, use the MailTip parameter on the Set-MailUser and Set-DynamicDistributionGroup cmdlets.
Regardless of whether you use the Exchange Control Panel or Windows PowerShell, two things always happen when you add a MailTip to a recipient:
HTML tags are automatically added to the text. For example, if you enter the following text: This mailbox is not monitored. The MailTip automatically becomes the following: <html><body>This mailbox is not monitored.</body></html>
The text is automatically added to the MailTipTranslations property as the default value. If you modify the MailTip text, the default value is automatically updated in the MailTipTranslations property.
Read more about that in the Configure MailTips article.

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 do I set the default sending email account in mail.app using AppleScript?

I'd like to use Control Plane to change the default sending account in mail.app (preferences->composing->send new messages from) when I switch from a work to a home environment. Control Plane doesn't have an option to do this, and I can't find anything in the mail.app AppleScript dictionary that might work … except, perhaps, "default email account", but that is r/o. Any ideas on ways to do this? I know I can do this message by message, but I want to change the default.
To set the default sending address, you can change the value of the Send new messages from: dropdown list in the Mail.app preferences window under the 'Composing' tab.
If you want to use AppleScript to change the sender once you're composing a message, that can be done using AppleScript as described in this question and answer.
In the Composing tab, you can choose to send new messages from the account of the selected mail box. You'll find out that this is sufficient in most cases. There is no way to automate this with AS afaik, except perhaps with GUI scripting.
(I agree that this question doesn't really belong on Stackoverflow).

Resources