office-js | NPM package for Office.js , corresponding to a copy | Email library
kandi X-RAY | office-js Summary
kandi X-RAY | office-js Summary
The NPM package for Office.js is a copy of what gets published to the official "evergreen" Office.js CDN, at The Office.js CDN contains all currently available Office.js APIs at any moment in time. Each Office.js NPM package contains only Office.js APIs available on the Office.js CDN when the NPM package version was created.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of office-js
office-js Key Features
office-js Examples and Code Snippets
Community Discussions
Trending Discussions on office-js
QUESTION
I've got a macro for sorting my incoming e-mail that I considered converting to Office-JS. I just saw this SO post and the answer stated --
Outlook web add-ins work under the context of currently selected item only
Does that mean my idea of an Add-In that sorts e-mail is unfeasible currently? Can I make an Add-In that constantly runs and redirects incoming e-mails?
...ANSWER
Answered 2022-Mar-24 at 08:10You can run add-in(s) only on a particular item(mail/calendar event). The Add-in framework does not support a trigger based on the incoming emails.
QUESTION
We're using Office JS to develop an Addin for Outlook Calendar. For the same appointment, the EWS Ids of the Organizer and Attendees do not match. Apparently I need ICalUid
from Exchange which is common across organizer and attendees and common across different events for the same Item, exactly what we need. But Office JS does not provide such property nor method to fetch it (only for .NET).
But Office JS provides Office.context.mailbox.makeEwsRequestAsync
with which I can make SOAP requests to the Exchange server, using XML.
What is the EWS SOAP XML code to get ICalUid
from EWS Id?
Does this work? Just replacing FieldURI
with ICalUid
?
ANSWER
Answered 2022-Mar-21 at 14:30For the IcalUid you would need
QUESTION
I've been using getRangeByIndexes
as it seems to be the best way to use numbers to get Ranges in Office-JS. Problem I'm having is that when I need to use entire row/columns, I've resorted to the below. I read up and looks like number of rows/cols hasn't changed in a long time, but I know in vba I used rows.count
to make sure the code was dynamic, whatever version of Excel it would use the number of rows on a spreadsheet.
Is there anything similar in Office-JS?
...ANSWER
Answered 2022-Mar-21 at 00:47This will do it for you ...
QUESTION
I am new to the Office-JS API, but trying to develop a POC to demonstrate the ability to, with the click of a button, replace all fields in a Word document with corresponding data retrieved from an API.
So I have developed an API as an Azure Function, which I can call, passing a value, and it will return the field names and values as JSON for the record that matches the passed value. I have tested this already using Postman.
Now I am trying to get the Office-JS piece working. I started with the VS-2022 template, which I have converted to TypeScript.
My intended approach is that when the user clicks the button, the application will call the API and obtain the record (data) fields as a set of name/value pairs.
Then, I want loop through all of the (data) fields returned, and for each (data) field name, check to see if there is a (document) field in the document by that name; if so, replace the (document) field with the (data) field's value.
This code is successfully finding the search criteria, and queueing up the replacements, in preparation for the context.sync call... But then during the context.sync call, is reporting an error "ItemNotFound."
I am following the recommended approach documented here https://docs.microsoft.com/en-us/office/dev/add-ins/concepts/correlated-objects-pattern under the "Process objects in the document with the correlated objects pattern" section.
My code follows:
...ANSWER
Answered 2022-Mar-16 at 19:35This all, ultimately, turned out to be caused by lack of a single await... Note the line below with the FETCH statement, which previously did not have an AWAIT before it.
QUESTION
I am new to the Office-JS API, but trying to develop a POC to demonstrate the ability to, with the click of a button, replace all fields in a Word document with corresponding data retrieved from an API.
So I have developed an API as an Azure Function, which I can call, passing a value, and it will return the field names and values as JSON for the record that matches the passed value. I have tested this already using Postman.
Now I am trying to get the Office-JS piece working. I started with the VS-2022 template.
My intended approach is that when the user clicks the button, the application will call the API and obtain the record (data) fields as a set of name/value pairs.
Then, I want loop through all of the (data) fields returned, and for each (data) field name, check to see if there is a (document) field in the document by that name; if so, replace the (document) field with the (data) field's value.
In the end, I realize it would likely be more efficient to loop the other way (loop through the doc fields, and then get the (data) field's value, etc.), but I figure I can tweak this once I get it working.
I also realize it's bad practice to perform a context.sync() within a loop, but again - I can clean that up once I get it working.
Right now, my code is reporting "Error: InvalidRequestContext: Cannot use the object across different request contexts."
My code follows:
...ANSWER
Answered 2022-Mar-09 at 23:02This is another common symptom of nested calls of context.sync. Fix the nesting first. Also, performance is better when you push filtering logic as close to the data source as possible. Consider designing the Azure Function to take in a list of fields and send back only data for matching names. Then your client side code is greatly simplified because you can assume there is a matching field for every data record that is returned.
QUESTION
I have a big Google Apps Script project working on Google Spreadsheets and I am trying to convert it to an office-js add-in that works on Excel Workbooks. I understand that it is good practice to put everything that will be calling excel specific functions (directly interacting with the workbook) into an Excel.run()
function so it does a proper clean-up and no memory leaks occur. I also understand I should do context.sync()
as little as possible to optimize performance.
Here are my questions, (I think some of them come from my incomplete grasp of how js works; these things GAS handled without me needing to question them) :
1a) When we put our block of code in
...ANSWER
Answered 2022-Mar-04 at 00:17I'll try to answer some of these questions and try to get some help for the others. I also recommend the book Building Office Add-ins for an understanding of the Office JavaScript library. See this too, if you haven't already: Application specific API model.
1a. Yes. That's essentially correct. Under the hood, Excel.run
creates an Office.RequestContext
object and passes it to the batch function parameter. (But your two code blocks are not literally equivalent. You would not call Excel.run
AND explicitly create a RequestContext
object.)
1b. From skimming the book I linked to, I think that you have to return
what the book calls the meta-promise so that the Excel.run
can resolve the Promise that it returns. Here's an example from the book:
QUESTION
We have a client that wants to run our Excel Add-in (web-based Office Add-in written with office-js), however, they don't have Edge or IE installed. They are running Version 2008 (Build 13127.21766) of Excel, which according to the documentation from Microsoft uses the EdgeHTML WebView (Edge Legacy)
I know with the WebView2 runtimes you can install the runtime separately since Windows 8.1 and 10 didn't come with that runtime. Can the same process be followed for the EdgeHTML WebView (Edge Legacy), as in can we install an EdgeHTML WebView runtime while not having Edge installed? If so can someone point me in the right direction on where to get this runtime from?
...ANSWER
Answered 2022-Mar-02 at 20:05The only way to get the EdgeHTML webview installed is to install Edge.
QUESTION
I'm trying to add Conditional Highlighting to a column in Excel via Office-JS. I used the automate
feature for the first time, but I can't seem to get it to work in Excel.
This is what automate spat out:
...ANSWER
Answered 2022-Feb-22 at 02:28You can use ConditionalFormatPresetCriterion to do this. Please see the example below:
QUESTION
Is it possible with an Outlook add-in to automatically reply only to certain emails/senders, based on custom logic? If so, how?
ExamplesSuch an add-in might send an automatic reply only to senders not in contacts, or only to senders whose email has been verified by an external service (which the add-in calls to check). This automatic reply might be:
Thanks for your email! I prioritize emails from verified senders. You can verify yourself for free here.
The sender who receives that message could then click the link and verify through the external service. Then, for future emails, the automatic reply would NOT apply to that sender.
BackgroundOutlook has an automatic reply option in settings, but its functionality is limited to setting a specific message for internal senders and a different one for external senders, plus choosing whether to only use the automatic reply with contacts. There's no built in ability to accomplish what's described in the examples above.
Other Questions and Answers (Possibly Relevant)- Office-js: How I can reply automatically with Outlook Web Add-in?: This may be relevant, but it's hard to tell because the link in the answer is broken now (the answer is from almost 4.5 years ago).
- How can I edit the automatic reply in outlook using c#: Also might be relevant, but also has a broken link in the answer (which is from almost 7 years ago).
Any help would be very much appreciated!
...ANSWER
Answered 2022-Feb-03 at 21:38Outlook web add-ins are designed for running for the currently selected item. So, the user should select a particular item in Outlook to activate the add-in. Unlike VSTO where you could handle incoming emails by handling the NewMailEx
event of the Application
class.
The NewMailEx
event fires when a new message arrives in the Inbox and before client rule processing occurs. Use the Entry ID returned in the EntryIDCollection
string to call the NameSpace.GetItemFromID method and process the item. This event fires once for every received item that is processed by Microsoft Outlook. The item can be one of several different item types, for example, MailItem
, MeetingItem
, or SharingItem
.
As soon as you have got an instance of the incoming email you can use the MailItem.Reply method which creates a reply, pre-addressed to the original sender, from the original message.
Finally, you may find the following articles helpful:
QUESTION
I have the following package.json
for my React project.
ANSWER
Answered 2022-Jan-14 at 10:32If you are using color
package, make sure that you are importing the package on theme.tsx
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install office-js
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page