OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
670 stars 96 forks source link

Excel Failing to load basic Custom Functions Add-in #733

Closed adam8797 closed 6 months ago

adam8797 commented 5 years ago

Message from office-js bot: We’re closing this issue because it has been inactive for a long time. We’re doing this to keep the issues list manageable and useful for everyone. If this issue is still relevant for you, please create a new issue. Thank you for your understanding and continued feedback.

This is a mirror of a question I posted on Stack Overflow, just trying to get more attention.

Please excuse my lack of formatting here. Because of a Corporate Firewall I’m not able to POST to github, so I’m submitting this from mobile.

I’ll copy the MarkDown from StackOverflow here, as it should contain all the same information that the issue template asks for, and I’ll be happy to fill any lapses in information or context


First, environment:

Excel Version 1905 (Build 11629.20246 Click-To-Run) Connected to Office 365 ProPlus

Windows 10 Enterprise 10.0.16299 Build 16299

I've been trying to work with the Custom Functions API in Excel, but its consistently failing to load my Manifest. I'm using Visual Studio for development, and its handling side loading.

The Add-In seems to partially load, as the task pane does open up and load, but none of my custom functions register.

I've also run the example project from https://github.com/OfficeDev/Excel-Custom-Functions-JS and it fails to load with similar errors.

My administrator has granted me access to the Add-In store, thinking that may be part of the issue, but it did not help.

Its my belief that there is some GPO or setting that has disabled the Custom Functions API, but I'm not about to find any documentation about such a setting. I've done everything I can to confirm that the Manifest I'm providing is valid, but still Excel claims that its invalid.

The basic structure of the Web Project is as follows:

C:.
│   Home.html
│   packages.config
│   WaveyWeb.csproj
│   WaveyWeb.csproj.user
│   Web.config
│   Web.Debug.config
│   Web.Release.config
│
├───dist
│       functions.html
│       functions.js
│       functions.json
│
└───Properties
        AssemblyInfo.cs

I've confirmed that the web server is serving the pages at the expected locations.

Here is the Manifest that I'm trying to load. Visual studio does NOT complain about it being invalid, and it is checking the schema. It does complain if I make any change that is invalid.

Note that ~remoteAppUrl is being correctly transformed at build time

<?xml version="1.0" encoding="UTF-8"?>
<!--Created:ce44715c-8c4e-446b-879c-ea9ebe0f09c8-->
<OfficeApp 
          xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" 
          xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides"
          xsi:type="TaskPaneApp">

  <Id>515f3886-1c17-41be-8393-26b5acfd676a</Id>

  <Version>1.0.0.0</Version>
  <ProviderName>Adam</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>

  <DisplayName DefaultValue="Project Wavey" />
  <Description DefaultValue="Its like excel, but with more waves"/>

  <IconUrl DefaultValue="~remoteAppUrl/Images/Button32x32.png" />

  <SupportUrl DefaultValue="http://www.contoso.com" />
  <!-- Domains that will be allowed when navigating. For example, if you use ShowTaskpane and then have an href link, navigation will only be allowed if the domain is on this list. -->
  <AppDomains>
    <AppDomain>AppDomain1</AppDomain>
  </AppDomains>
  <!--End Basic Settings. -->

  <!--Begin TaskPane Mode integration. This section is used if there are no VersionOverrides or if the Office client version does not support add-in commands. -->
  <Hosts>
    <Host Name="Workbook" />
  </Hosts>

  <Requirements>
    <Sets DefaultMinVersion="1.1">
      <Set Name="CustomFunctionsRuntime" MinVersion="1.1"/>
    </Sets>
  </Requirements>

  <DefaultSettings>
    <SourceLocation DefaultValue="~remoteAppUrl/Home.html" />
  </DefaultSettings>
  <!-- End TaskPane Mode integration.  -->

  <Permissions>ReadWriteDocument</Permissions>

  <!-- Begin Add-in Commands Mode integration. -->
  <VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
    <Hosts>
      <Host xsi:type="Workbook">
        <AllFormFactors>
          <ExtensionPoint xsi:type="CustomFunctions">
            <Script>
              <SourceLocation resid="CustomFunc.URL.JS"/>
            </Script>
            <Page>
              <SourceLocation resid="CustomFunc.URL.HTML"/>
            </Page>
            <Metadata>
              <SourceLocation resid="CustomFunc.URL.JSON"/>
            </Metadata>
            <Namespace resid="CustomFunc.Namespace"/>
          </ExtensionPoint>
        </AllFormFactors>
      </Host>
    </Hosts>

    <!-- You can use resources across hosts and form factors. -->
    <Resources>
      <bt:Urls>
        <bt:Url id="CustomFunc.URL.JS" DefaultValue="~remoteAppUrl/dist/functions.js"/>
        <bt:Url id="CustomFunc.URL.HTML" DefaultValue="~remoteAppUrl/dist/functions.html"/>
        <bt:Url id="CustomFunc.URL.JSON" DefaultValue="~remoteAppUrl/dist/functions.json"/>
      </bt:Urls>
      <bt:ShortStrings>
        <bt:String id="CustomFunc.Namespace" DefaultValue="WAVE" />
      </bt:ShortStrings>
    </Resources>
  </VersionOverrides>
  <!-- End Add-in Commands Mode integration. -->
</OfficeApp>

See my WEF Logs:

9/18/2019 9:33:42   Medium  Web Add-In Runtime Logging Session Started          
9/18/2019 9:33:42   Monitorable Manifest    Skipped unrecognized XML element for add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Script", Line=52, CharPosition=14     
9/18/2019 9:33:42   Monitorable Manifest    Skipped unrecognized XML element for add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Page", Line=55, CharPosition=14       
9/18/2019 9:33:42   Monitorable Manifest    Skipped unrecognized XML element for add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Metadata", Line=58, CharPosition=14       
9/18/2019 9:33:42   Monitorable Manifest    Skipped unrecognized XML element for add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Namespace", Line=61, CharPosition=14      
9/18/2019 9:33:42   Monitorable Manifest    Extension point list has no supported extension points for this client      
9/18/2019 9:33:42   Monitorable Manifest    Issue encountered while parsing manifest, add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Error at element "VersionOverrides" : Manifest override with unsupported requirements or no supported extension points ignored: http://schemas.microsoft.com/office/taskpaneappversionoverrides, VersionOverridesV1_0, Line=78, CharPosition=5       
9/18/2019 9:33:42   Monitorable Manifest    Skipped unrecognized XML element for add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Script", Line=52, CharPosition=14     
9/18/2019 9:33:42   Monitorable Manifest    Skipped unrecognized XML element for add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Page", Line=55, CharPosition=14       
9/18/2019 9:33:42   Monitorable Manifest    Skipped unrecognized XML element for add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Metadata", Line=58, CharPosition=14       
9/18/2019 9:33:42   Monitorable Manifest    Skipped unrecognized XML element for add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Namespace", Line=61, CharPosition=14      
9/18/2019 9:33:42   Monitorable Manifest    Extension point list has no supported extension points for this client      
9/18/2019 9:33:42   Monitorable Manifest    Issue encountered while parsing manifest, add-in ID : 515f3886-1c17-41be-8393-26b5acfd676a, Location : Error at element "VersionOverrides" : Manifest override with unsupported requirements or no supported extension points ignored: http://schemas.microsoft.com/office/taskpaneappversionoverrides, VersionOverridesV1_0, Line=78, CharPosition=5       
9/18/2019 9:34:43   Unexpected  Manifest    Access to the manifest XML file is denied. Contact an administrator of this add-in for help.        
9/18/2019 9:34:43   Unexpected  Catalog Access to your add-ins trusted catalog has been denied. Select Insert > My Add-ins > Excel Options > Trust Center > Trust Center Settings > Trusted Add-in Catalogs to check your trusted catalogs.     
9/18/2019 9:34:43   Unexpected  Manifest    Access to the manifest XML file is denied. Contact an administrator of this add-in for help.        
9/18/2019 9:34:47   Unexpected  Manifest    Access to the manifest XML file is denied. Contact an administrator of this add-in for help.        
9/18/2019 9:34:47   Unexpected  Catalog Access to your add-ins trusted catalog has been denied. Select Insert > My Add-ins > Excel Options > Trust Center > Trust Center Settings > Trusted Add-in Catalogs to check your trusted catalogs.     

I think my issue is happening before the loading of the actual scripts, but for completeness here are the contents of the files in /dist/

functions.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <title></title>
    <script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/custom-functions-runtime.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>

functions.js

/**
 * Adds two numbers.
 * @customfunction 
 * @param first First number.
 * @param second Second number.
 * @returns The sum of the two numbers.
 */

function add(first, second) {
    return first + second;
}

CustomFunctions.associate("ADD", add);

functions.json

{
  "functions": [
    {
      "id": "ADD",
      "name": "ADD",
      "description": "Add two numbers",
      "helpUrl": "http://www.contoso.com/help",
      "result": {
        "type": "number",
        "dimensionality": "scalar"
      },
      "parameters": [
        {
          "name": "first",
          "description": "first number to add",
          "type": "number",
          "dimensionality": "scalar"
        },
        {
          "name": "second",
          "description": "second number to add",
          "type": "number",
          "dimensionality": "scalar"
        }
      ]
    }
  ]
}
keyur32 commented 5 years ago

Hi @adam8797, I responded on StackOverflow. For now, if you can, I'd recommend following the Custom Functions tutorial to debug with VS Code, which you can do on Windows or Excel for the web.

adam8797 commented 5 years ago

@keyur32 thanks for the reply. I’ll try to keep the two threads in sync, but I figure the issue is probably better for discussion.

To recap the SO comments, I’m running the following:

Visual Studio 2019 Version 16.2.5 with Office Developer Tools 16.0.28818.01

And I also attached Fiddler and confirmed that the only web request Excel makes is to the home page

adam8797 commented 5 years ago

I just attempted to run the example project found in https://github.com/OfficeDev/Excel-Custom-Functions by doing the following:

  1. Download the Zip version of the repo
  2. Open power shell in the root
  3. npm install
  4. npm start
  5. Excel starts, the task pane logo is visible, but the custom functions are not available.

WEF Logs

9/19/2019 13:22:06  Medium  Web Add-In Runtime Logging Session Started          
9/19/2019 13:22:06  Monitorable Manifest    Skipped unrecognized XML element for add-in ID : ca968be6-628b-4f14-ba3c-3e614effa9bd, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Script", Line=35, CharPosition=14     
9/19/2019 13:22:06  Monitorable Manifest    Skipped unrecognized XML element for add-in ID : ca968be6-628b-4f14-ba3c-3e614effa9bd, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Page", Line=38, CharPosition=14       
9/19/2019 13:22:06  Monitorable Manifest    Skipped unrecognized XML element for add-in ID : ca968be6-628b-4f14-ba3c-3e614effa9bd, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Metadata", Line=41, CharPosition=14       
9/19/2019 13:22:06  Monitorable Manifest    Skipped unrecognized XML element for add-in ID : ca968be6-628b-4f14-ba3c-3e614effa9bd, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Namespace", Line=44, CharPosition=14      
9/19/2019 13:22:06  Monitorable Manifest    Skipped unrecognized XML element for add-in ID : ca968be6-628b-4f14-ba3c-3e614effa9bd, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Script", Line=35, CharPosition=14     
9/19/2019 13:22:06  Monitorable Manifest    Skipped unrecognized XML element for add-in ID : ca968be6-628b-4f14-ba3c-3e614effa9bd, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Page", Line=38, CharPosition=14       
9/19/2019 13:22:06  Monitorable Manifest    Skipped unrecognized XML element for add-in ID : ca968be6-628b-4f14-ba3c-3e614effa9bd, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Metadata", Line=41, CharPosition=14       
9/19/2019 13:22:06  Monitorable Manifest    Skipped unrecognized XML element for add-in ID : ca968be6-628b-4f14-ba3c-3e614effa9bd, Location : Element Namespace "http://schemas.microsoft.com/office/taskpaneappversionoverrides" : Element Name "Namespace", Line=44, CharPosition=14      
xiaochunms commented 5 years ago

Regarding to https://github.com/OfficeDev/Excel-Custom-Functions, you may miss a step "npm run build" before "npm start" is executed.

adam8797 commented 5 years ago

@xiaochunms just ran it agin on a fresh copy of the repo and I saw no change. Logs still complain about unrecognized XML

keyur32 commented 5 years ago

Hey, thanks for the additional details. I would like to double check your version of office as that channel may not yet support custom functions.

Just to double check. Open excel > get addins > in the store dialog search for an addin: “Data drum”. Does it appear and let you insert the addin and custom function?

adam8797 commented 5 years ago

@keyur32 I tried to add it, but I’m leaning inconclusive on this one. The add-in “Data Drum” failed to install and start, with my WEF logs complaining that access to the Manifest XML failed (similar to the errors from the initial post). However, I’m also behind a corporate firewall and its very possible that I’m just not able to install external add-ins. I tried some others from the store, and nothing would install.

xiaochunms commented 4 years ago

There is a tutorial you may can have a try: https://docs.microsoft.com/en-us/office/dev/add-ins/tutorials/excel-tutorial-create-custom-functions?tabs=excel-windows.

ghost commented 4 years ago

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

kbrandl commented 4 years ago

Please disregard the @msftbot's comment about this issue being marked as stale; I've updated tags so this is no longer the case.

adam8797 commented 4 years ago

@kbrandl Thanks, I’m still interested in finding a fix for this.

@xiaochunms I’ve gone through that tutorial already, and I have what I believe should be a working add-in. I’ve also tried the example add-ins and none work. I think this issue is before the add-in even gets loaded, or during the parsing of the manifest. Either with my setup or with Excel, but I need some more help determining which is the culprit.

tballast commented 3 years ago

Is there any update on this? I'm experiencing the exact same problem.