Excel add-in interaction with other Office365 applications - excel

I'm exploring Office 365 development and I'm trying with Excel add-ins.
One thing I'd like to was to interact with other Office applications, like Outlook, OneDrive and Word - from Excel.
For example, I'd like to send an email from an Excel table and/or insert the value of a cell in a Word document.
After searching the documentation, I couldn't find if this is possible, so I'd appreciate some help.
I'm new to Office development.
Thanks in advance!

Add-ins (Office.js) run in separate instances of browsers (controlled by the Office apps). This makes it difficult to pass messages between apps. Browser storage (cookies, localStorage and IndexedDatabase) can't consistently see each other's data/events when in separate instances. Because of this, we had to pass messages through our servers just to communicate between Excel, Word, and PowerPoint on the same device. Microsoft currently does not provide an API to communicate between add-ins in different apps.

Related

How do I distribute excel office add-in(w/ office.js) in privately?

Q1. Are there any method to distribute excel office add-in(w/ office.js) in privately?
(Will office.js add-in also be distributed like VSTO's .exe OR .xla/.xlam macro files with password?)
Q2. If I run office add-in server(node.js) on my on-premise server, What will have to be distributed to the end-users?
(I want to hide the core source logic unlike VBA macro.)
I am now developing an excel office add-in. But there seems to be some limitation to deploy to the end-users in my company.(We are now testing environment for pilot, and using office 365 but it is restricted by IT's policy)
When I refer to the official documentation below, the docs says that the way to deploy add-in in privately are Microsoft 365 admin center OR SharePoint catalog.(AppSource is publicly for everyone.)
refer. https://learn.microsoft.com/en-us/office/dev/add-ins/publish/publish
However, it seems that it have to use Microsoft's services or components like SharePoint or admin center. I don't want to use these items because I want to flexibly cope with various environments.
I have also read the article as below.
refer. How to distribute private office add-ins?
But the reply thread seems that the writer couldn't get the appropriate answer what I also want to know.
I want to know the other ways to distribute excel office add-in(w/ office.js) without unveiling my core source logic and what is the minimum materials I have to provide to the end-users(i.g. manifest or something).
Typically, as you have already know, you need to host the add-in's source code on the web server anywhere. The manifest file just refers to the place where the sources are stored. And the single file which should be provided to be able to side-load add-ins locally is the manifest file. Everything else is hosted under your control.
Due to the nature of the web technology you can't hide the source code from users. The add-in acts like a regular web page. The best what you could do is to obfuscate your code.

Excel Javascript API - Sharing

(Desktop version) I'm new to using the javascript API for excel, but is it possible to create an excel add-in and share with other users without having to add the add-in to an app source etc? Can it be embedded in the excel file etc. I'd like to share scripts with other users the same way that I can share VBA if it's possible?
for security reasons as well as to make manageability of your add-ins easier, we do not store the code within the workbook, like VBA. Instead, the javascript is hosted on your website and we have a reference to your add-in saved in the workbook.
What this means, is to get a similar experience to VBA, you must either have the add-in hosted on app source (which will make it accessible via the Office Store), OR each user in an organization must have the add-in deployed or available to them (here we recommend centralized deployment as it will give the most robust experience).
This has all the current deployment options you can use for Office add-ins: https://learn.microsoft.com/en-us/office/dev/add-ins/publish/publish
thanks!

Are there more methods for the "application" object?

Am I right to conclude that I may have to wait for certain objects and methods to appear in order to launch one office App from another?
I'm trying to link a number of Excel lines (customer interactions) one to one with OneNote pages.
I cannot find Office-js methods equivalent to those used in this VBA. I looked in the Office.js documentation and see only a couple of methods.
It is perfectly possible that I'm barking up the wrong tree.
This isn't possible with using Office.js. It's important to remember that each Web Add-in runs within its own sandbox and is essentially just a web app. It simply isn't possible for a Web Add-in to determine what other applications you have and remotely execute code against them (nor would you really want this if you consider the potential security risks that would open up).
What you can do however is leverage Microsoft Graph to interact with OneNote. So rather than having Excel drive OneNote over COM, you have your Web Add-in act as middleware between the current Excel Worksheet and a user's OneNote Notebook. You Add-in uses Office.js to communicate with the Worksheet and make REST calls to Microsoft Graph to interact the Notebook.
The first thing you'll need is an Access Token for the Excel user to use with Microsoft Graph. You can obtain this using the getAccessToken() method in Office.js. The steps for setting this up can be found at Authorize to Microsoft Graph in your Office Add-in (preview).
The second thing you'll need is to call Microsoft Graph. Assuming you want to keep things simple, I would use the Microsoft Graph Client SDK for Javascript for this. You'll also want to take a look at the OneNote API overview
from Microsoft Graph's documentation.
There are also some samples in OneNote's GitHub. Although none of the samples are exactly what you're looking for, they may still provide some valuable insights into how the API works.

In an Office Add-in developed using Office.js for Office Online, where is the process hosting the office application?

I have read the entire VSTO documentation to start with and skimmed over most of the Office Add-ins (office.js) documentation on MSDN but not found the answer to my question.
Could you please provide me with an answer and also, if possible, please point me to the page on MSDN that answers my question?
Question
In a scenario where the client computer does not have Microsoft Office installed, and is using a browser to access Office Online, and he loads an Office add-in written using Office.js, in such a scenario, where is the computer that hosts the COM objects and the Office process they reside in?
Here is my understanding of the elements involved in using Office.js add-ins:
There's the Open XML document that has the data. This is just dead-meat. It had to be loaded into a process.
Earlier, that process used to be the unmanaged WINWORD.EXE (or EXCEL.EXE or POWERPNT.EXE or another office application) process.
Now, with office.js, when using Office Online, i.e. the Web client, the unmanaged Office process still has to be allocated in memory in some computer? Basically, that's the core of my question.
My guess is
that it has to, and that the process may be run remotely on a
server. The document itself may be hosted remotely, which isn't a
big deal but the process, too, is required and in the case of Office
Online, the unmanaged office process is run on a remote computer. It
is this assumption I want to confirm or invalidate.
There's the client UI. This used to be a mesh of unmanaged C++ code within the office application and managed UI created by .NET using VSTO and Windows Forms or WPF. Now, with Office.js, this is done using HTML/CSS/JavaScript and can be loaded by any kind of a client (desktop/Web).
The process hosting the document and providing the underlying Document, Bookmark, Range et al objects. My question is -- for Office Online clients that do not have MS Office installed on the client computer, where is this process now if they use Office Add-ins written using office.js?
Am I wrong in assuming that the JavaScript API for Office Add-ins merely calls into the existing Office COM infrastructure we already know about? If I am right, then where is the machine that hosts the Winword.exe (or whichever Office application) process?
To answer the question of where the code is executed: There are no "COM" objects per se (the new wave of Office.js APIs is not based on the VBA COM objects, at least not directly). But there is indeed a backing server that has the document open and in-memory. In the case of Excel, the Excel Online front-end is a fairly "thin" layer, and almost all operations are executed by the supporting server. That server doesn't run EXCEL.exe directly, but it has a web service that is kinda-sorta-like Excel (and that shares a lot of the same underlying C++ code), which runs in a "headless" mode, one instance per document. In the case of Word, on the other hand, Word Online has a lot more business logic that it can execute locally, and so a lot of the operations are executed on the browser and sync back up to the server at idle time (much like end-user operations), but there is still a backing server that serves the appropriate data to the Word Online front-end, and that processes some operations (e.g., range.getOoxml(), or image.getImage()).
Hope this helps.
Office Web Add-ins (office-js) are web apps that leverage a specific library (office-js) to facilitate communication between the add-in and the host application.
As these add-ins are simply web apps, they work across the various Office platforms (Windows, Web, Mac, iOS). For browser based Office editions, add-ins are surfaced in an iframe. For native editions they are hosted in an embedded browser (IE11, Webkit, etc. depending on the platform).
Add-ins consist of two components, an XML manifest and the web app. The manifest can be loaded from a number of locations from directly side-loading, to a network share, to the Office Store. The web app is hosted wherever you would normally host your web apps (I recommend Azure but then I'm a bit biased). They are never hosted by Microsoft directly.

Is it possible to develop for Office 365 (confusion due to new-to-365)

I'm not even sure if it's possible at all. Earlier, I've been designing addons to Outlook and Excel (using VSTO and VBA). Now, my company got into this Office 365 thinking and we have all our environment online, no local software at all, strictly and only web client approach.
It's got its advantages. But the downside is that out support have no clue how it works (except to tell us to click the settings and look for options, sigh). So, I wonder if it's possible to develop and somehow upload my own customizations (NB we have no servers in the cloud - everything is provided on SAS basis).
Suppose I'd like to:
mark all emails from a certain sender with yellow background in the list in Outlook, or
highlight every occurrence of the word "donkey" in the text mass in Word.
Is it doable at all?
I've googled for it but all I can see is that there's an API and that we need to runt the stuff on our own servers. Am I just confusing myself here?
First of all, if you have O365 subscription, you actually still have the ability to download all desktop version of Office. So your existing customizations should still work on Desktop version of Office.
Second,check out Office Add-in on dev.office.com. Office Add-ins extend the functionality of Office with a web app that lives within Office applications. They work similar to traditional VBA add-ons and we have a rich set of API that helps you interact with Office. This is basically a web app with JavaScript, HTML and CSS. You can build it with any tools you are familiar with and host it anywhere. It is really easy to build and let us know if you have more questions.
Thanks,
Sky
Your best bet for highlighting messages from specific senders would be to use the Outlook REST APIs to access the messages and either stamp a specific category color on the messages, or a flag to highlight the message in the list view. That approach would work across both Web, Outlook, and even Mobile (if you use flags). The new Outlook add-in model is powerful and works for Outlook on the Web, as well as Outlook on Windows, but doesn't allow you to update the colors of the list view add-ins.

Resources