Web-based Outlook add-in to read and process message contents - outlook

I want to create a web based Outlook Add-in which does not run in the context of a message or appointment. I simply thought about a new group with one button on the home tab. On click, a new window should be shown.
In platform-dependent concepts (like vsto) this was possible. But it seems that this scenario isnĀ“t supported by the new web concepts. At least not in outlook.
The program should run more like a service and observe the outbox and read (extract and transform) and prepare specific messages (maybe archive their contents locally - which is another problem because of the sandbox mechanism).
I want to deploy to windows and mac desktop clients.
Is that even possible?
Is a module extension an alternative? (Is it supported on mac?)

Task Panes and contextual Custom Panes are designed to interact with the selected/open message. You can define add-in commands (custom Ribbon buttons: https://dev.office.com/docs/add-ins/outlook/manifests/define-add-in-commands) that run a JavaScript function in your defined .html page. These functions can do whatever you want and don't necessarily have to interact with the message or Mailbox whatsoever.
However there is no feature that allows you to run a background application - your custom code always has to be executed by the user. The alternative is to use the Graph API (or Exchange Web Services) in a web server or client application context.
A module extension is similar to add-in commands, but by default doesn't run in the context of any message. Module extensions are essentially just a canvas for displaying web pages, but you have access to the Mailbox API.

Related

Is there a way to force a mailto to launch Outlook (despite the default Email app setting in windows)

I have a link in a web app that uses mailto: to launch an email (with default values for To, Subject, and Body). That said, when this link is clicked by an end user, it opens with whatever default Email app they have setup in Windows. All of my end users have Outlook, and some have (likely unintentionally) selected values other than Outlook as their default Email app. This became apparent, this morning, when one of my end users complained and I found their default Email app was simply Chrome.
Is there a way to force the mailto: command to launch Outlook despite the end users default Email app value?
It is not a good idea but you can force another application assuming it is also registered as some type of protocol/file handler.
Use ShellExecuteEx with SEE_MASK_CLASSNAME or SEE_MASK_CLASSKEY and lpClass/hkeyClass to the applications progid under HKEY_CLASSES_ROOT (Outlook.xyz or something like that).
See also:
How do I ShellExecute a file, but with a specific program instead of the default program?
There is no way to force a specific email client on the end-user machine using the mailto protocol. Read more about possible parameters for the mailto protocol in MSDN or MDN.
You may consider automating Outlook from a web browser, but only Internet Explorer understands and aware about COM automation. Other web browsers can't use automation and is not aware about COM for security reasons.

Send file via Teams (like MAPISendMail)

My (editor-like) Windows desktop program can create a new e-mail with the current project attached using MAPISendMail. A customer wants the same functionality for Microsoft Teams.
For the web version, I think I can probably do that with Graph API.
But I can't find anything for the desktop app version. Is there a way to do that?
Bonus:
It would be great if the user could manually specify recipient + body text in Teams (and not in my program).
So you can't actually attach files to messages directly - you basically upload the file to a web location, and then provide a link to the file in the message. As an example, you can upload to the SharePoint document library that exists in the "Files" tab (something like this). Then, in terms of sending the message, you can send to a Team/Channel quite easily using a Webhook. This does not support #mentions the moment though. Another option is to use Graph to send the message.
If you're wanting instead to send a kind of 'private' message to the user, you'd need to look into creating a bot, and sending a 'Proactive' message

Outlook and Gmail Link to create event

I'm using outlook and gmail links to create events.
I populate the params for each link and publishing it to the users.
The link for outlook:
https://outlook.office.com/owa/?path=/calendar/action/compose&rru=addevent&startdt=2021-05-24T12:00:00&enddt=2021-05-26T19:00:00&subject=Change This With A Subject &location=Change This With A Location&body=Change This With A Body Description.
My question is:
It's possible to click, for example, on outlook link (like the link above) to create the event, but somehow make it open the Desktop outlook app and not outlook web?
Many Thanks,
For the URL specified - no. They are run by web browsers by default.
URLs with the https protocol handler are run by web browsers. But you can register a custom protocol handler on a client machine that can launch Outlook by default and pass parameters as you do for a web browser. Read more about that in the Understanding Protocol Handlers article.
Also, you may find Outlook command-line switches helpful, see Command line switches for Outlook 365, 2019, 2016, 2013, 2010 and previous for more information.

Log incoming and outgoing emails using Outlook web add-in

I have a working VSTO COM based Outlook add-in that intercepts all incoming/outgoing emails on a desktop outlook which is then used to save the details of the email into a SQL database. Below is a brief description of the steps I take using the add-in:
Intercept an incoming/outgoing email and adds a custom GUID as a user property on the email
Calls an end-point to my custom Web API on the cloud and sends an XML with details like the GUID (saved above) and other mail related ids and details
The API end-point saved the details into a SQL database and returns the response back to Outlook so that Outlook doesn't freeze up
A windows service runs in the background and monitors this SQL database for email items and makes a Web API call to Exchange or Office 365 to find the email using the GUID user property and then save it where needed.
I cannot save the email directly via the API call from VSTO add-in since there is some custom time-consuming logic that happens in the API so I cannot keep Outlook frozen for that time.
Is it possible to create something similar using the newer Outlook Web Add-in?
Kind of - you can intercept outgoing messages, but if you do, your addin won't be eligible to be published in the store.
It is still much easier in a VSTO addin. You cannot access Outlook Object Model from a secondary thread, but you can still run your code that does other things. Once you are done, you can access OOM on the main thread by opening message that you need to process by its entry id saved before you started the secondary thread. Note that the inability to access various objects from a secondary thread is OOM specific - Extended MAPI objects can be accessed from secondary threads, but Extended MAPI requires C++ or Delphi. In other languages (including all .Net languages), you can use Redemption (I am its author) and its RDO family of objects - all you need to do is save the value of the Application.Session.MAPIOBJECT property in a dedicated variable, then on a secondary thread create an instance of the RDOSession object and set its MAPIOBJECT property to the variable you saved on the main thread (see http://www.dimastr.com/redemption/faq.htm#Threads for more details).

command for sent mail in outlook web app addin

Recently I tried the outlook web app add-in in visual studio 2015. It's cool one It purely based on the Java script commands. My ultimate motivation i need add one button in add-in if user click that button I need the save the mail my database and send that mail to the recipient.
I am able to fetch the data and saving to my database is successful but unable to trigger send option in add-in. There is any java script command available. Actually I have achieved the same scenario in outlook windows application.
You should be able to send the email using the new Outlook REST APIs specifically we have an api for sending emails. In addition, to close the compose form, you can use the Office.context.mailbox.item.close() To close the mail or calendar item in compose.
You should try to send the email from server side logic using EWS (exchange web services) see this post or you can authenticate with Azure Active Directory and invoke the outlook REST API

Resources