Git Product home page Git Product logo

office-addin-scripts's Introduction

Office-Addin-Scripts

These packages provide functionality which can be used to perform tasks related to Office Add-ins. The packages export functions which can be imported and used in Node scripts. Many of the packages also provide a command-line interface (CLI), allowing them to be used directly from a Command Prompt / Terminal window.

The Yo Office templates provide a starting point for developing an Office Add-in. These scripts are used in the templates to provide for basic developer tasks such as debugging.

Developers may have other workflows with different requirements and tooling. Our goal is for the these packages to serve as building blocks which can be adapted as needed. We encourage feedback and contributions from the community.

The Excel Custom Functions project provides an example of how these packages may be used.

In this repository

  • custom-functions-metadata

    This package allows metadata for custom functions to be generated automatically from JSDoc tags and the function parameter types.

  • custom-functions-metadata-plugin

    A WebPack plugin which generates the metadata for custom functions.

  • office-addin-cli

    A command-line interface for Office Add-ins.

  • office-addin-debugging

    This package provides the orchestration of components related to debugging Office Add-ins. When debugging is started, it will ensure that the dev-server is running, that dev settings are configured for debugging, and will register and sideload the Office Add-in. When debugging is stopped, it will unregister and shutdown components.

  • office-addin-dev-certs

    This package can be used to manage certificates for development server using https://localhost.

  • office-addin-dev-settings

    This package can be used to configure developer settings for an Office Add-in.

  • office-addin-lint

    This package can be used to ensure code quality with lint rules and standardize code formatting.

  • office-addin-manifest

    This package provides the ability to parse, display, and modify the manifest file for Office Add-ins.

  • office-addin-mock

    This package provides a way to unit test the Office JavaScript API.

  • office-addin-node-debugger

    This package allows a Node instance to serve as a proxy for debugging a JavaScript runtime hosted by an Office application.

  • office-addin-sso

    This package provides the ability to register an application in Azure Active Directory and infrastructure for implementing single sign-on (SSO) taskpane add-ins.

  • office-addin-test-helpers

    This package provides tools that make validating your Office Add-in easier. You can use it with the office-addin-test-server package and the Mocha test framework (or another testing framework of your choice).

  • office-addin-test-server

    This package provides a framework for testing Office task pane add-ins by allowing add-ins to send results to a test server. The results can then be consumed and used by tests to validate that the add-in is working as expected.

  • office-addin-usage-data

    This package allows for sending usage data event and exception data to the selected telemetry infrastructure (e.g. ApplicationInsights)

Requirements

Getting started

In a command prompt, run:

  • npm install

This should also be done when after pulling additional changes or switching branches.

Build

To build all packages, at the root directory, run:

  • npm run build

To build a single package, in the directory for the package, run:

  • npm run build

Test

To run tests for all packages, at the root directory, run:

  • npm run test

To run tests for a single package, in the directory for the package, run:

  • npm run test

Editing

Use VS Code to edit, build, test, and debug by opening the package folder in VS Code.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

Quickstart with Git

  1. Install Git, NodeJs and VS Code if you haven’t ready.
  2. Create a GitHub account if you don’t already have one.
  3. Go to https://github.com/OfficeDev/Office-Addin-Scripts
  4. Create a fork of OfficeDev/Office-Addin-Scripts in GitHub
  5. In a command prompt:
    1. git clone https://github.com/OfficeDev/Office-Addin-Scripts
    2. cd Office-Addin-Scripts
    3. git remote add {username} https://github.com/{username}/Office-Addin-Scripts.git (where “{username}” is your GitHub user name)
    4. git checkout -b my-branch-name (recommend using all lowercase with hyphens for branch names)
  6. Make your desired changes
  7. Commit your changes and push the fork you created
    1. git commit
    2. git push -u {username} {branch-name}
  8. Go to Office-Addin-Scripts and create a pull request.

Feedback

Reporting Security Issues

Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) at [email protected]. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter.

Join the Microsoft 365 Developer Program

Join the Microsoft 365 Developer Program to get resources and information to help you build solutions for the Microsoft 365 platform, including recommendations tailored to your areas of interest.

You might also qualify for a free developer subscription that's renewable for 90 days and comes configured with sample data; for details, see the FAQ.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

License

Code licensed under the MIT License.

Data usage

The Office Add-in CLI tools collect anonymized usage data and send it to Microsoft. This allows us to understand how the tools are used and how to improve them.

For more details on what we collect and how to turn it off, see our Data usage notice

office-addin-scripts's People

Contributors

adrian-msft avatar akrantz avatar asachin96 avatar aszczepanski avatar dependabot[bot] avatar donaldgu avatar elizabethsamuel-msft avatar igor-ribeiiro avatar jozefizso avatar julflore000 avatar kwame-ansong avatar lindalu-msft avatar millerds avatar ndeleuze avatar nokafor avatar parched avatar pkkj avatar quanfuxiao avatar ralphtheninja avatar rick-kirkham avatar tcourtneyowen avatar thesamsterza avatar timwan10 avatar villasv avatar wandyezj avatar xai-msft avatar yueli-msft avatar zhngx avatar ztcddsb avatar zyun-msft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

office-addin-scripts's Issues

[office-addin-sso] - jquery error

I've created an SSO-enabled Outlook add-in by using the Yeoman generator and running npm run configure-sso (as described in the SSO quick start). I'm unable to successfully run this add-in in Outlook on the web, due to error $ is not defined being thrown from message-helper.js in the Office Add-in SSO package.

Screenshot:

image

Consider changing "office-addin-debugging start" syntax for --packager and --dev-server

Currently, --dev-server <command> specifies to run the packager and --dev-server-port <number> specifies to check whether the dev-server is running on the port.

Consider simplifying into a single --dev-server <url> [command] option. If present it would indicate to ensure that the dev-server is running (using the url or the port parsed from the url), and it would start the dev-server if not already running using the specified command.

For example: office-addin-debugging start manifest.xml --dev-server https://localhost:3000 "npm run dev-server"

Similarly, the --packager option could be updated to use --packager <url> [command].
For example: office-addin-debugging start manifest.xml --packager http://localhost:8081 "npm run packager"

Excel: Add-in "manifest.xml" file with invalid version still passes validation when using the Excel-Custom-Functions repo's validation command

Expected Behavior

According to the docs (https://docs.microsoft.com/en-us/office/dev/add-ins/reference/manifest/version), the manifest file requires the version to be structure with 4 numbers (<Version>n .n .n .n</Version>). Manifest validation should pass when the version follows (e.g. 1.0.0.0) and should fail when it does not (e.g. 1.0.0).

Current Behavior

Starting with a valid manifest file, change the version to something that only has 3 numbers in it (e.g. 1.0.0). Attempt to validate this manifest file again. Validation still passes. This is very problematic for debugging -- This version actually is accepted by Desktop Excel, but fails when trying to install the add-in with Excel in the browser. Both desktop and Excel Online should both handle the manifest in the same manner. Since this pertains specifically to the manifest being invalid, though, this could be headed off at the pass if the manifest validation simple would fail and let the user know that their version is not valid.

Steps to Reproduce, or Live Example

Follow the steps in this tutorial: https://docs.microsoft.com/en-us/office/dev/add-ins/quickstarts/excel-custom-functions-quickstart?tabs=excel-windows

After running yo office, select the following options:

? Choose a project type: Excel Custom Functions Add-in project
? Choose a script type: JavaScript
? What do you want to name your add-in? My Office Add-in
  1. Run npm run validate. Works!
  2. Build the add-in with npm run build and then run it with npm start.
  3. Open the add-in in Excel Desktop. Works!
  4. Open the add-in in Excel Online (by uploading the manifest.xml file). Works!

Now, edit the manifest.xml file and change the version from <Version>1.0.0.0</Version> to <Version>1.0.0</Version>. Run npm stop and then follow the exact same steps above.

  1. Run npm run validate. Works! (even though it should error out because the version in invalid according to the manifest.xml docs (https://docs.microsoft.com/en-us/office/dev/add-ins/reference/manifest/version)
  2. Build the add-in with npm run build and then run it with npm start.
  3. Open the add-in in Excel Desktop. Works!
  4. Open the add-in in Excel Online (by uploading the manifest.xml file). Fails. This is the error message that loads right away after uploading the manifest file:

excel-online-add-in-error

Context

This issue actually me about a day's worth of work as I thought there was actually an issue with my custom function. Since the error message attached is shown before any code is called, there is no way to debug what is going on. If the error messages were a bit more clear and stated that there was an error in the manifest file (or even better -- WHAT is wrong in the manifest file), that would probably go a long way to making this a better experience.

Your Environment

  • Platform [PC desktop, Mac, iOS, Office Online]: PC desktop & Office Online
  • Host [Excel, Word, PowerPoint, etc.]: Excel
  • Office version number:

    Microsoft Excel for Office 365 MSO (16.0.12022.20000) 64-bit
    Version 1902 (Build 12022.20000 Click-to Run)
    Office Insider

  • Operating System: Windows 10
  • Browser (if using Office Online):

    Google Chrome | 76.0.3809.100 (Official Build) (64-bit) (cohort: Stable)
    Revision: ed9d447d30203dc5069e540f05079e493fc1c132-refs/branch-heads/3809@{#990}
    OS: Windows 10 OS Version 1903 (Build 18362.295)

Useful logs

  • Console errors
  • Screenshots
  • Test file (if only happens on a particular file)

office-addin-debugging 'stop' doesn't work on MacOS

On macOS 10.14.5, starting the debugger with npm run start which runs office-addin-debugging start manifest.xml spins up a debugging server but in a detached process. Running npm run stop or office-addin-debugging stop manifest.xml does not stop the process.

The only way I was able to get it to stop was to find the node process that had port 3000 open and kill it with Activity Monitor.

office-addin-debugging: detached dev-server process not visible on Mac

On Mac, if the dev certs are not installed and the dev-server is not running, the office-addin-debugging start command will start the dev-server as a detached process. Since there is no window, the user cannot enter the password for the dev certs. After 30 seconds it times out.

custom-functions-metadata: incorrect metadata if `@customfunction` comes before description

The following will not generate metadata properly:

/**
  * @customfunction
  * A custom function
  */
function custom() {
}

It appears that it is related to the @customfunction tag which now takes optional id and name, and it reads the next line as part of the tag. So the "A" is read as the id and "custom" is read for the tag resulting in metadata:
{
"id": "A",
"name": "custom",
}

expected metadata:
{
"id": "CUSTOM",
"name": "CUSTOM",
}

custom-functions-metadata: improve code and tests for parameter types

  • Use the TypeScript compiler JSDoc support to parse the @param type rather than just reading the string. Unify the code for parameter types from @param versus parameter types from TypeScript directly.
  • The error messages need to be improved.
  • The code needs to be refactored so that the metadata type/dimensionality is treated as a unit.
  • Need better test coverage of simple parameter types, array types, invocation parameter types, other JavaScript/TypeScript types (enum, union, object, Error, etc.)
  • There is lots of opportunity to make the code more modular and readable.

[office-addin-manifest] issues installing & running

Hey all,

Thanks for putting a package together to assist in the validation of a manifest.

Not sure if this is an issue with my install or what but the office-addin-manifest package does not appear to work out of the box for me. Exact steps below.

Version check + install

C:\Users\SeanK> node -v
v10.16.3
C:\Users\SeanK> npm -v
6.9.0
C:\Users\SeanK> npm install -g office-addin-manifest
C:\Program Files\nodejs\office-addin-manifest -> C:\Program Files\nodejs\node_modules\office-addin-manifest\cli.js
+ [email protected]

So far so good. I re-open the window but then I can't get it to tell me what version it is:

C:\Users\SeanK> office-addin-manifest
Usage: office-addin-manifest [options] [command]

Options:
  -V, --version                     output the version number
  -h, --help                        output usage information

Commands:
  info <manifest-path>
  modify [options] <manifest-path>
  validate <manifest-path>
C:\Users\SeanK> office-addin-manifest -V
(version not available)
C:\Users\SeanK> office-addin-manifest -v
error: unknown option `-v'

And when I validate a manifest that I copied from the docs I can't get the tool to provide a response:

C:\Users\SeanK> office-addin-manifest validate C:\Users\SeanK\Repositories\[Redacted]\AppManifest.xml
Error: The manifest validation service did not return the expected response.

I pulled up Fiddler to see if any traffic was going out to a validation service but that doesn't appear to be the case.

Version info

To recap the above:

  • Winver: Windows 10 Build 1903 (18362.356)
  • Node: 10.16.3
  • Npm: 6.9.0
  • office-addin-manifest: 1.4.2.

[office-addin-lint] support TypeScript 3.8 syntax

The new syntax in TypeScript 3.8 is not supported.
Could you update the dependent packages?

import type { IObjectWithKey } from "@uifabric/utilities";
  1:14  error  Parsing error: '=' expected  prettier/prettier

Thank you.

[office-addin-manifest] Please export validate and xml

main.ts contains exports of classes and functions that can then be imported like so:

import { readManifestFile, ManifestInfo } from 'office-addin-manifest';

Please add validate and xml to this list, so that TypeScript can use the goodness in there as well:

import { validateManifest, ManifestValidation } from 'office-addin-manifest';

Thank you.

Office-Addins & Blazor: Possible?

Is it possible to combine Blazor and Office Addins? Would like to be able to execute .NET standard libraries from the task pane.

My apologies if this is already listed somewhere, I've been able to find anything in searches.

Unable to start the dev server. Error: The dev server is not running on port 3000.

I'm going through the tutorial to build my first Outlook add-in. I am on Windows 10, and am using the Yeoman generator to create an Angular app:

https://docs.microsoft.com/en-us/outlook/add-ins/quick-start?context=office%2Fdev%2Fadd-ins%2Fcontext&tabs=yeomangenerator

Everything is going well until I get to this step:

Run the following command in the root directory of your project. When you run this command, the local web server will start (if it's not already running).

npm start

If I run npm start, I get this output:

> [email protected] start D:\Office Addin\src\OfficeAddin.Outlook
> office-addin-debugging start manifest.xml

Debugging is being started...
App type: desktop
Enabled debugging for add-in 05c2e1c9-3e1d-406e-9a91-e9ac64854143. Debug method: 0
Starting the dev server... (webpack-dev-server --mode development)
Unable to start the dev server. Error: The dev server is not running on port 3000.
Debugging started.

What am I doing wrong?

Guidance for process.env

Hi

I created a React Word AddIn and want to use something like process.env.ENVIRONMENT. Can you please provide some guidance on how to determine if the code is running locally or in production?

Thank you!
Pascal

office-addin-dev-certs: keeps adding new certs on mac

When the certificate has less than a day until expiry, the certificate verification step fails, and it adds a new certificate. The next time it tries to verify the certificate, it still sees the old certificate, and creates another new certificate.

This is how you are verifying certificates:

case "darwin": // macOS
return `security find-certificate -c '${defaults.certificateName}' -p | openssl x509 -checkend 86400 -noout`;

The security find-certificate call finds the first matching certificate, which is the expiring one, even after a new certificate is added.

eslint-config-office-addins 1.0.16 is missing the lib folder

Prerequisites

Please answer the following questions before submitting an issue.
YOU MAY DELETE THE PREREQUISITES SECTION.

  • I am running the latest version of Node and the tools
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Expected behavior

by running "npm install eslint-config-office-addins" the latest version of the npm module is installed and works
(all seems to work with version [email protected])

Current behavior

after I run the lint comment via the "npm run lint" command I get this:

[email protected] lint:office [EDITED_PATH] office-addin-lint check

Oops! Something went wrong! :(

ESLint: 6.8.0.

ESLint couldn't find the config "eslint-config-office-addins" to extend from. Please check that the name of the config is correct.

The config "eslint-config-office-addins" was referenced from the config file in "[EDITED_PATH]/.eslintrc.json".

If you still have problems, please stop by https://gitter.im/eslint/eslint to chat with the team.

Steps to Reproduce

follow the instruction in the README.md of this repo: https://github.com/OfficeDev/Office-Addin-Scripts/blob/master/packages/office-addin-lint/README.md

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Operating System: OSX Catalina (10.15.6)
  • Node version: v10.17.0
  • Office version: not relevant
  • Tool version: eslint-config-office-addins 1.0.16

custom-functions-metadata-plugin: using it twice on separate files creates extra CustomFunctions.associate() calls

Our Office JS Add-in's webpack build creates two separate websites. They both maintain the same set of custom functions, but have different implementations in two different typescript files. We are using the CustomFunctionsMetadataPlugin on each of them to generate the CustomFunctions.associate() calls in the corresponding output js files. However, it looks like when you use the plugin more than once, then you get extra CustomFunctions.associate() calls in your js output. Can this be fixed so only the custom functions found in each typescript file are added to the corresponding js file?

custom-functions-metadata: non-streaming functions should be able to return a Promise

For a custom function which needs to do an async operation, it will need to return a Promise where ResultType is an allowed result type.

Currently only a function that returns ResultType directly is supported, but not Promise.

  • update spec to include returning a Promise for non-streaming functions.
  • add test cases for returning a Promise from the function
  • fix the implementation to allow returning a Promise

Module not found: Error: Can't resolve 'https' in Angular app

Getting the following error in an Angular app.

ERROR in ./node_modules/office-addin-sso/lib/odata-helper.js
Module not found: Error: Can't resolve 'https' in '***\node_modules\office-addin-sso\lib'

I think it is due to the fact that Angular no longer assumes Node modules are available.

Unable to delete registry value

Hi,

I created a started app with Yeoman using [email protected]
Here is the console output:

`npm start desktop

[email protected] start C:\Users\xxx\excel-addin
office-addin-debugging start manifest.xml "desktop"

Debugging is being started...
App type: desktop
Enabled debugging for add-in 05c2e1c9-3e1d-406e-9a91-e9ac64854143. Debug method: 0
Starting the dev server... (webpack-dev-server --mode development)
The dev server is running on port 3000. Process id: 22816
Sideloading the Office Add-in...
Error: Unable to start debugging.
Error: Unable to sideload the Office Add-in.
Error: Unable to delete registry value "C:\Users\xxx\excel-addin\manifest.xml" in key "HKCU\SOFTWARE\Microsoft\Office\16.0\Wef\Developer".
ProcessUncleanExitError: DELETE command exited with code 1:

Erreur�: Erreur�: le syst�me n'a pas trouv� la cl� ou la valeur de Registre sp�cifi�e.`

This error is preventing the debugging from starting. After digging aroud a bit, I think issue lies with the RegistryKey class. The deleteValue function (line 112) is matching the error message to a specific string in english, but my system is returning an error message in french.

If I create the value it is looking for in the registry before starting the debugger I do not have an issue.

Linux support?

I attempted to run the Add-in generator on Linux, but I hit an exception from office-addin-dev-certs that the linux platform is not supported. Is making this compatible with Linux as easy as updating the getInstallCommand, getUninstallCommand, and getVerifyCommand functions with a case for linux? If so, I'd be happy to submit a PR.

custom-functions-metadata: implicit return type

If the function return type is not explicitly specified using TypeScript or @returns {type}, the type is always any. It should detect a simple type (boolean, number, string), matrix type (any[][], boolean[][], number[][], string[][]), etc.

    /**
     * @customfunction
     */
    function returnsBoolean() {
      return true;
    }

EXPECTED:

result: {
   "type": "boolean";
}

ACTUAL:

result: { }

Unable to Specify Template Document

In visual studio we have the option to specify a template file that our sideloaded app starts with. With this, the template is hard coded. A flag or environment variable to change this would be awesome.

Can't start dev server in other port than 3000

I'm currently developing an Excel add-in in Windows 10. Since I'm trying to open two instances of the add-in in different ports, I'm trying to start another dev-server in port 44389 by doing

office-addin-debugging start manifest.xml desktop --dev-server-port 44389

but the following output shows up:

Debugging is being started...
App type: desktop
Enabled debugging for add-in 20c008db-10d8-4e87-bed4-29aaa26f673b. Debug method: 0
Starting the dev server... (webpack-dev-server --mode development)
Unable to start the dev server. Error: The dev server is not running on port 44389.
Sideloading the Office Add-in...
Debugging started.

If I run the application with the default port (3000), it works ok.

Dialog box for Outlook Add-In On Send

I currently have a function which is called when the sent button is pressed, so I am able to get the fields I require. The purpose of the add-in is log emails which need to be recorded for financial rules.

What I'm trying to do is add a dialog box when send is pressed asking if they need to log that particular email. I've looked at the dialog samples but they aren't overly helpful for running on Events.

When the MessageSent function is called I've even tried calling a separate dialog box:
function ShowDialog() { var dialog; Office.context.ui.displayDialogAsync('/Dialog.html', { height: 30, width: 20 }, function (asyncResult) { dialog = asyncResult.value; dialog.addEventHandler(Office.EventType.DialogMessageReceived, processMessage); } ); }

Has anyone got this kind of email sending confirmation to work?

Essentially I need this but with different text:
image

setting for enabling loopback for edge does not get saved when called through office-addin-dev-settings

Expected behavior

When using office-addin-dev-settings to enable loopback for Edge, expect to set it once and the settings get saved so it does not need to prompt the user for confirmation to set the loopback.

Current behavior

The prompt for enabling loopback confirmation keeps showing up, so when using office-addin-debugging to sideload office during automation, the automation will get paused.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. call ensureLoopbackIsEnabled in code to enable the loopback
  2. call npx office-addin-debugging start ... it will prompt again for enabling the loopback

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Operating System: 1903
  • Node version: 12.16.1
  • Office version:
  • Tool version: [email protected] or above

Unhandled promise rejection: "office-addin-dev-certs install" but say no to prompt

To repro:
On Windows 10, starting without any .office-addin-dev-certs folder or certs installed, run:
office-addin-dev-certs install
When prompted to install the CA certificate, say "n" for no.

Result:

c:\dev\git\Office-Addin-Scripts\packages\office-addin-dev-certs>node lib\cli.js install
The developer certificates have been generated in C:\Users\adamk\.office-addin-dev-certs
Installing CA certificate "Developer CA for Microsoft Office Add-ins"...
(node:256) UnhandledPromiseRejectionWarning: Error: Unable to install the CA certificate. Import-Certificate : The operation was canceled by the user. (Exception from HRESULT: 0x800704C7)
At line:1 char:1
+ Import-Certificate -CertStoreLocation cert:\CurrentUser\Root C:\Users ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Import-Certificate], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.CertificateServices.Commands.Impor
   tCertificateCommand


    at c:\dev\git\Office-Addin-Scripts\packages\office-addin-dev-certs\lib\install.js:52:19
    at Generator.next (<anonymous>)
    at c:\dev\git\Office-Addin-Scripts\packages\office-addin-dev-certs\lib\install.js:6:71
    at new Promise (<anonymous>)
    at __awaiter (c:\dev\git\Office-Addin-Scripts\packages\office-addin-dev-certs\lib\install.js:2:12)
    at installCaCertificate (c:\dev\git\Office-Addin-Scripts\packages\office-addin-dev-certs\lib\install.js:44:12)
    at Object.<anonymous> (c:\dev\git\Office-Addin-Scripts\packages\office-addin-dev-certs\lib\install.js:38:19)
    at Generator.next (<anonymous>)
    at fulfilled (c:\dev\git\Office-Addin-Scripts\packages\office-addin-dev-certs\lib\install.js:3:58)
(node:256) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:256) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

custom-functions-metadata test is not reliable

The test will frequently fail. It may succeed when re-run but the cause of the timing problem leading to the failure needs to be fixed.

  1) test javascript file as input
       js test
         basic test:

      AssertionError [ERR_ASSERTION]: json file not created
      + expected - actual

      -false
      +true

      at Context.<anonymous> (test\src\test.ts:65:20)
      at Generator.next (<anonymous>)
      at fulfilled (test\src\test.ts:3:58)
      at process._tickCallback (internal/process/next_tick.js:68:7)

Linting Error: Cannot find module '{path containing a space here}'

It looks like the loader doesn't accept spaces in the path.

Part 1.

npm run lint

[email protected] lint {path}*My Outlook Add-in*
office-addin-lint check

internal/modules/cjs/loader.js:800
throw err;
^

Error: Cannot find module '{path}*My*'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
at Function.Module._load (internal/modules/cjs/loader.js:690:27)
at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
at internal/main/run_main_module.js:17:11 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] lint: office-addin-lint check
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! {profile}\AppData\Roaming\npm-cache_logs\2020-02-06T15_14_32_020Z-debug.log

Part 2.

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'lint'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prelint', 'lint', 'postlint' ]
5 info lifecycle [email protected]prelint: [email protected]
6 info lifecycle [email protected]
lint: [email protected]
7 verbose lifecycle [email protected]lint: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]
lint: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;{path}\My Outlook Add-in\node_modules.bin;C:\Python27;C:\Python27\Scripts;C:\Program Files (x86)\Embarcadero\Studio\20.0\bin;C:\Users\Public\Documents\Embarcadero\Studio\20.0\Bpl;C:\Program Files (x86)\Embarcadero\Studio\20.0\bin64;C:\Users\Public\Documents\Embarcadero\Studio\20.0\Bpl\Win64;C:\Program Files (x86)\Embarcadero\Studio\19.0\bin;C:\Users\Public\Documents\Embarcadero\Studio\19.0\Bpl;C:\Program Files (x86)\Embarcadero\Studio\19.0\bin64;C:\Users\Public\Documents\Embarcadero\Studio\19.0\Bpl\Win64;C:\Program Files (x86)\Borland\Delphi7\Bin;C:\Program Files (x86)\Borland\Delphi7\Projects\Bpl;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\Symantec.cloud\PlatformAgent;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\dotnet;C:\WINDOWS\System32\OpenSSH;C:\Program Files\TortoiseGit\bin;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn;C:\Program Files\Microsoft SQL Server\130\DTS\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\nodejs;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;{profile}\AppData\Local\Microsoft\WindowsApps;{profile}\AppData\Local\atom\bin;{profile}\AppData\Local\Microsoft\WindowsApps;{profile}\AppData\Roaming\npm;{profile}\AppData\Local\Programs\Microsoft VS Code\bin;{profile}\AppData\Local\GitHubDesktop\bin;{profile}\AppData\Local\Programs\Fiddler
9 verbose lifecycle [email protected]lint: CWD: {path}\My Outlook Add-in
10 silly lifecycle [email protected]
lint: Args: [ '/d /s /c', 'office-addin-lint check' ]
11 silly lifecycle [email protected]lint: Returned: code: 1 signal: null
12 info lifecycle [email protected]
lint: Failed to exec lint script
13 verbose stack Error: [email protected] lint: office-addin-lint check
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:210:5)
13 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:210:5)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid [email protected]
15 verbose cwd {path}\My Outlook Add-in
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "lint"
18 verbose node v12.13.1
19 verbose npm v6.12.1
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] lint: office-addin-lint check
22 error Exit status 1
23 error Failed at the [email protected] lint script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Uppercasing a Custom Function causes "duplicate function name" error

If you have a function like "add10" and call parseTree with it, it will generate the proper result:

/** @CustomFunction */
function ADD10(x: number): number {
  return x + 10;
}
    [
        {
            "javascriptFunctionName": "ADD10",
            "nonCapitalizedFullName": "TestNamespace.ADD10",
            "status": "good",
            "errors": [],
            "metadata": {
                "id": "TESTNAMESPACE.ADD10",
                "name": "TESTNAMESPACE.ADD10",
                "parameters": [
                    {
                        "name": "x",
                        "type": "number"
                    }
                ],
                "result": {
                    "type": "number"
                }
            }
        }
    ]

But if you were to capitalize the function to "ADD10", it throws an error!

"@customfunction tag specifies a duplicate name: ADD10 (1,1)"

The issue was found by David Chestnut in Script Lab: OfficeDev/script-lab#709

Could you please fix the package and then update script lab? You can check it in directly into branch "fix-709" (https://github.com/OfficeDev/script-lab/tree/fix-709), where I added a test that currently fails due to this issue.

custom-functions-metadata-plugin: emit CustomFunctions.associate() calls

Instead of the developer having to explicitly put the calls to CustomFunctions.associate("ID", func), it would be nice to have the webpack plugin be able to emit this.

The way to do this is to tap into the render event of the moduleTemplates so that for the "functions" module, after the code is rendered, it can add the additional lines to add the CustomFunctions.associate() calls.

Application Insights errors

Prerequisites

Node: v12.16.3

Current behavior

When developing an Excel add-in, office-addin-debugging continuously throws the following exceptions:

ApplicationInsights:Sender [
  'Ingestion endpoint could not be reached 20 consecutive times. There may be resulting telemetry loss. Most recent error:',
  Error: socket hang up
      at connResetException (internal/errors.js:608:14)
      at Socket.socketOnEnd (_http_client.js:453:23)
      at Socket.emit (events.js:322:22)
      at endReadableNT (_stream_readable.js:1187:12)
      at processTicksAndRejections (internal/process/task_queues.js:84:21) {
    code: 'ECONNRESET'
  }
]

ApplicationInsights:Sender [
  'Not saving data due to max size limit being met. Directory size in bytes is: 50000175'
]

Is there any way to either disable Application Insights or squelch this error? In addition, what directory is the error message referring to? I have not been able to find any documentation on these issues.

ESLint files Pattern

When i run npm run lint, i get the following message

> office-addin-lint check


Oops! Something went wrong! :(

ESLint: 6.8.0.

No files matching the pattern "src/**/*.js" were found.
Please check for typing mistakes in the pattern.

I'm writing a taskpane for Excel with Typescript and React.
I haven't changed anything on the eslint configuration.

I'm have this on my package.json

 "office-addin-lint": "^1.0.21",

Thanks.

When username in Windows machine has an space on, application crashes when installing certificates

In a office add-in development environment when executing the command : npm run dev-server

console output:

> [email protected] dev-server C:\Users\Edwin Veroes\Documents\outlook-addin-reactjs
> webpack-dev-server --mode development

The developer certificates have been generated in C:\Users\Edwin Veroes\.office-addin-dev-certs
Installing CA certificate "Developer CA for Microsoft Office Add-ins"...
Error: Unable to install the CA certificate. Import-Certificate : A positional parameter cannot be found that accepts argument 'Veroes\.office-addin-dev-certs\ca.crt'.
At line:1 char:1
+ Import-Certificate -CertStoreLocation cert:\CurrentUser\Root C:\Users ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Import-Certificate], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.CertificateServices.Commands.ImportCertificateCommand


    at C:\Users\Edwin Veroes\Documents\outlook-addin-reactjs\node_modules\office-addin-dev-certs\lib\install.js:58:19
    at Generator.next (<anonymous>)
    at C:\Users\Edwin Veroes\Documents\outlook-addin-reactjs\node_modules\office-addin-dev-certs\lib\install.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\Edwin Veroes\Documents\outlook-addin-reactjs\node_modules\office-addin-dev-certs\lib\install.js:4:12)
    at installCaCertificate (C:\Users\Edwin Veroes\Documents\outlook-addin-reactjs\node_modules\office-addin-dev-certs\lib\install.js:47:12)
    at Object.<anonymous> (C:\Users\Edwin Veroes\Documents\outlook-addin-reactjs\node_modules\office-addin-dev-certs\lib\install.js:41:19)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\Edwin Veroes\Documents\outlook-addin-reactjs\node_modules\office-addin-dev-certs\lib\install.js:5:58)

this is caused because the resultant .js of the file ./packages/office-addin-dev-certs/src/install.ts outputs in the line 21 for the command for windows the variable "caCertificatePath" without surrounding quotation marks.

image

Was able to work around this by adding simple quotation marks to the resultant .js file but changes need to be done to the .ts file in your repo.

image

npm task issues

All of the tasks are failing for me. I'm wondering if it's my scenario and it's an edge case.

PS Z:\jason_r On My Mac\source\ToucanOfficeAddIn> npm run start

[email protected] start Z:\jason_r On My Mac\source\ToucanOfficeAddIn
office-addin-debugging start manifest.xml

npm : 'office-addin-debugging' is not recognized as an internal or external command,
At line:1 char:1

  • npm run start
  •   + CategoryInfo          : NotSpecified: ('office-addin-d...ternal command,:String) [], RemoteException
      + FullyQualifiedErrorId : NativeCommandError
    
    

operable program or batch file.

Even though I have done an npm install with no errors the tools are still being seen as unknown commands.

I am running a VM instance of Windows on a mac, and I am running the project from a shared drive from the host.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.