Outlook Web Add-in not executing named function












0















Following the documentation in several places [mostly on Microsoft here: https://docs.microsoft.com/en-us/javascript/api/office/office.addincommands.event?view=office-js and here: https://docs.microsoft.com/en-us/outlook/add-ins/add-in-commands-for-outlook but also from various searches etc] I am unable to get the UI Less Functions to work in Outlook Desktop or Outlook Web Access.



Both appear to call the function-file as I can test that and successfully see output from the Office.Initilize function. But I can never get the actual named function to call at all.



I've seen lots of examples and can't find anyone else complaining that it doesn't work so must be doing something wrong but I can't spot the fault:



Manifest:



<?xml version="1.0" encoding="UTF-8"?>
<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:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0"
xsi:type="MailApp">

<!-- Begin Basic Settings: Add-in metadata, used for all versions of Office unless override provided. -->

<!-- IMPORTANT! Id must be unique for your add-in, if you reuse this manifest ensure that you change this id to a new GUID. -->
<Id>e540c7ff-41e8-47a2-b2ae-7e3cae3336bc</Id>

<!--Version. Updates from the store only get triggered if there is a version change. -->
<Version>1.0.0.2</Version>
<ProviderName>[Provider name]</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<!-- The display name of your add-in. Used on the store and various places of the Office UI such as the add-ins dialog. -->
<DisplayName DefaultValue="FunctionExecuteTest" />
<Description DefaultValue="[Outlook Add-in description]"/>

<!-- Icon for your add-in. Used on installation screens and the add-ins dialog. -->
<IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png" />
<HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/hi-res-icon.png"/>

<!--If you plan to submit this add-in to the Office Store, uncomment the SupportUrl element below-->
<!--<SupportUrl DefaultValue="[Insert the URL of a page that provides support information for the app]" />-->

<!-- 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>
<AppDomain>AppDomain2</AppDomain>
<AppDomain>AppDomain3</AppDomain>
</AppDomains>
<!--End Basic Settings. -->

<Hosts>
<Host Name="Mailbox" />
</Hosts>
<Requirements>
<Sets>
<Set Name="Mailbox" MinVersion="1.3" />
</Sets>
</Requirements>
<FormSettings>
<Form xsi:type="ItemRead">
<DesktopSettings>
<SourceLocation DefaultValue="https://localhost:3000/index.html"/>
<RequestedHeight>250</RequestedHeight>
</DesktopSettings>
</Form>
</FormSettings>

<Permissions>ReadWriteItem</Permissions>
<Rule xsi:type="RuleCollection" Mode="Or">
<Rule xsi:type="ItemIs" ItemType="Message" FormType="Read" />
</Rule>
<DisableEntityHighlighting>false</DisableEntityHighlighting>

<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
<Requirements>
<bt:Sets DefaultMinVersion="1.3">
<bt:Set Name="Mailbox" />
</bt:Sets>
</Requirements>
<Hosts>
<Host xsi:type="MailHost">

<DesktopFormFactor>
<!-- Location of the Functions that UI-less buttons can trigger (ExecuteFunction Actions). -->
<FunctionFile resid="functionFile" />

<!-- Message Read -->
<ExtensionPoint xsi:type="MessageReadCommandSurface">
<!-- Use the default tab of the ExtensionPoint or create your own with <CustomTab id="myTab"> -->
<OfficeTab id="TabDefault">
<!-- Up to 6 Groups added per Tab -->
<Group id="msgReadGroup">
<Label resid="groupLabel" />
<!-- Function (UI-less) button -->
<Control xsi:type="Button" id="eventTestButton">
<Label resid="funcComposeButtonLabel" />
<Supertip>
<Title resid="funcComposeSuperTipTitle" />
<Description resid="funcComposeSuperTipDescription" />
</Supertip>
<Icon>
<bt:Image size="16" resid="icon16" />
<bt:Image size="32" resid="icon32" />
<bt:Image size="80" resid="icon80" />
</Icon>
<Action xsi:type="ExecuteFunction">
<FunctionName>testEventObject</FunctionName>
</Action>
</Control>
<!-- Go to http://aka.ms/ButtonCommands to learn how to add more Controls: ExecuteFunction and Menu -->
</Group>
</OfficeTab>
</ExtensionPoint>
<!-- Go to http://aka.ms/ExtensionPointsCommands to learn how to add more Extension Points: MessageRead, AppointmentOrganizer, AppointmentAttendee -->
</DesktopFormFactor>
</Host>
</Hosts>

<Resources>
<bt:Images>
<bt:Image id="icon16" DefaultValue="https://localhost:3000/assets/icon-16.png"/>
<bt:Image id="icon32" DefaultValue="https://localhost:3000/assets/icon-32.png"/>
<bt:Image id="icon80" DefaultValue="https://localhost:3000/assets/icon-80.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="functionFile" DefaultValue="https://localhost:3000/function-file/function-file.html"/>
<bt:Url id="messageReadTaskPaneUrl" DefaultValue="https://localhost:3000/index.html"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="groupLabel" DefaultValue="Test Add-in Group"/>
<bt:String id="funcComposeButtonLabel" DefaultValue="Test Tab"/>
<bt:String id="funcComposeSuperTipTitle" DefaultValue="Execute the test that's been setup"/>
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="funcComposeSuperTipDescription" DefaultValue="Does something, something expected..."/>
</bt:LongStrings>
</Resources>
</VersionOverrides>
</OfficeApp>


function-file.js:



// The initialize function must be run each time a new page is loaded
Office.initialize = reason => {
console.log('Office init...' + reason);
};

// Add any ui-less function here
function testEventObject(event) {
var buttonId = event.source.id;
console.log('testEventObject() called, buttonID: ' + buttonId);
event.complete();
}


What I actually get:



Browser Console Log



Hopefully something simple I'm missing!










share|improve this question



























    0















    Following the documentation in several places [mostly on Microsoft here: https://docs.microsoft.com/en-us/javascript/api/office/office.addincommands.event?view=office-js and here: https://docs.microsoft.com/en-us/outlook/add-ins/add-in-commands-for-outlook but also from various searches etc] I am unable to get the UI Less Functions to work in Outlook Desktop or Outlook Web Access.



    Both appear to call the function-file as I can test that and successfully see output from the Office.Initilize function. But I can never get the actual named function to call at all.



    I've seen lots of examples and can't find anyone else complaining that it doesn't work so must be doing something wrong but I can't spot the fault:



    Manifest:



    <?xml version="1.0" encoding="UTF-8"?>
    <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:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0"
    xsi:type="MailApp">

    <!-- Begin Basic Settings: Add-in metadata, used for all versions of Office unless override provided. -->

    <!-- IMPORTANT! Id must be unique for your add-in, if you reuse this manifest ensure that you change this id to a new GUID. -->
    <Id>e540c7ff-41e8-47a2-b2ae-7e3cae3336bc</Id>

    <!--Version. Updates from the store only get triggered if there is a version change. -->
    <Version>1.0.0.2</Version>
    <ProviderName>[Provider name]</ProviderName>
    <DefaultLocale>en-US</DefaultLocale>
    <!-- The display name of your add-in. Used on the store and various places of the Office UI such as the add-ins dialog. -->
    <DisplayName DefaultValue="FunctionExecuteTest" />
    <Description DefaultValue="[Outlook Add-in description]"/>

    <!-- Icon for your add-in. Used on installation screens and the add-ins dialog. -->
    <IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png" />
    <HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/hi-res-icon.png"/>

    <!--If you plan to submit this add-in to the Office Store, uncomment the SupportUrl element below-->
    <!--<SupportUrl DefaultValue="[Insert the URL of a page that provides support information for the app]" />-->

    <!-- 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>
    <AppDomain>AppDomain2</AppDomain>
    <AppDomain>AppDomain3</AppDomain>
    </AppDomains>
    <!--End Basic Settings. -->

    <Hosts>
    <Host Name="Mailbox" />
    </Hosts>
    <Requirements>
    <Sets>
    <Set Name="Mailbox" MinVersion="1.3" />
    </Sets>
    </Requirements>
    <FormSettings>
    <Form xsi:type="ItemRead">
    <DesktopSettings>
    <SourceLocation DefaultValue="https://localhost:3000/index.html"/>
    <RequestedHeight>250</RequestedHeight>
    </DesktopSettings>
    </Form>
    </FormSettings>

    <Permissions>ReadWriteItem</Permissions>
    <Rule xsi:type="RuleCollection" Mode="Or">
    <Rule xsi:type="ItemIs" ItemType="Message" FormType="Read" />
    </Rule>
    <DisableEntityHighlighting>false</DisableEntityHighlighting>

    <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
    <Requirements>
    <bt:Sets DefaultMinVersion="1.3">
    <bt:Set Name="Mailbox" />
    </bt:Sets>
    </Requirements>
    <Hosts>
    <Host xsi:type="MailHost">

    <DesktopFormFactor>
    <!-- Location of the Functions that UI-less buttons can trigger (ExecuteFunction Actions). -->
    <FunctionFile resid="functionFile" />

    <!-- Message Read -->
    <ExtensionPoint xsi:type="MessageReadCommandSurface">
    <!-- Use the default tab of the ExtensionPoint or create your own with <CustomTab id="myTab"> -->
    <OfficeTab id="TabDefault">
    <!-- Up to 6 Groups added per Tab -->
    <Group id="msgReadGroup">
    <Label resid="groupLabel" />
    <!-- Function (UI-less) button -->
    <Control xsi:type="Button" id="eventTestButton">
    <Label resid="funcComposeButtonLabel" />
    <Supertip>
    <Title resid="funcComposeSuperTipTitle" />
    <Description resid="funcComposeSuperTipDescription" />
    </Supertip>
    <Icon>
    <bt:Image size="16" resid="icon16" />
    <bt:Image size="32" resid="icon32" />
    <bt:Image size="80" resid="icon80" />
    </Icon>
    <Action xsi:type="ExecuteFunction">
    <FunctionName>testEventObject</FunctionName>
    </Action>
    </Control>
    <!-- Go to http://aka.ms/ButtonCommands to learn how to add more Controls: ExecuteFunction and Menu -->
    </Group>
    </OfficeTab>
    </ExtensionPoint>
    <!-- Go to http://aka.ms/ExtensionPointsCommands to learn how to add more Extension Points: MessageRead, AppointmentOrganizer, AppointmentAttendee -->
    </DesktopFormFactor>
    </Host>
    </Hosts>

    <Resources>
    <bt:Images>
    <bt:Image id="icon16" DefaultValue="https://localhost:3000/assets/icon-16.png"/>
    <bt:Image id="icon32" DefaultValue="https://localhost:3000/assets/icon-32.png"/>
    <bt:Image id="icon80" DefaultValue="https://localhost:3000/assets/icon-80.png"/>
    </bt:Images>
    <bt:Urls>
    <bt:Url id="functionFile" DefaultValue="https://localhost:3000/function-file/function-file.html"/>
    <bt:Url id="messageReadTaskPaneUrl" DefaultValue="https://localhost:3000/index.html"/>
    </bt:Urls>
    <bt:ShortStrings>
    <bt:String id="groupLabel" DefaultValue="Test Add-in Group"/>
    <bt:String id="funcComposeButtonLabel" DefaultValue="Test Tab"/>
    <bt:String id="funcComposeSuperTipTitle" DefaultValue="Execute the test that's been setup"/>
    </bt:ShortStrings>
    <bt:LongStrings>
    <bt:String id="funcComposeSuperTipDescription" DefaultValue="Does something, something expected..."/>
    </bt:LongStrings>
    </Resources>
    </VersionOverrides>
    </OfficeApp>


    function-file.js:



    // The initialize function must be run each time a new page is loaded
    Office.initialize = reason => {
    console.log('Office init...' + reason);
    };

    // Add any ui-less function here
    function testEventObject(event) {
    var buttonId = event.source.id;
    console.log('testEventObject() called, buttonID: ' + buttonId);
    event.complete();
    }


    What I actually get:



    Browser Console Log



    Hopefully something simple I'm missing!










    share|improve this question

























      0












      0








      0








      Following the documentation in several places [mostly on Microsoft here: https://docs.microsoft.com/en-us/javascript/api/office/office.addincommands.event?view=office-js and here: https://docs.microsoft.com/en-us/outlook/add-ins/add-in-commands-for-outlook but also from various searches etc] I am unable to get the UI Less Functions to work in Outlook Desktop or Outlook Web Access.



      Both appear to call the function-file as I can test that and successfully see output from the Office.Initilize function. But I can never get the actual named function to call at all.



      I've seen lots of examples and can't find anyone else complaining that it doesn't work so must be doing something wrong but I can't spot the fault:



      Manifest:



      <?xml version="1.0" encoding="UTF-8"?>
      <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:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0"
      xsi:type="MailApp">

      <!-- Begin Basic Settings: Add-in metadata, used for all versions of Office unless override provided. -->

      <!-- IMPORTANT! Id must be unique for your add-in, if you reuse this manifest ensure that you change this id to a new GUID. -->
      <Id>e540c7ff-41e8-47a2-b2ae-7e3cae3336bc</Id>

      <!--Version. Updates from the store only get triggered if there is a version change. -->
      <Version>1.0.0.2</Version>
      <ProviderName>[Provider name]</ProviderName>
      <DefaultLocale>en-US</DefaultLocale>
      <!-- The display name of your add-in. Used on the store and various places of the Office UI such as the add-ins dialog. -->
      <DisplayName DefaultValue="FunctionExecuteTest" />
      <Description DefaultValue="[Outlook Add-in description]"/>

      <!-- Icon for your add-in. Used on installation screens and the add-ins dialog. -->
      <IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png" />
      <HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/hi-res-icon.png"/>

      <!--If you plan to submit this add-in to the Office Store, uncomment the SupportUrl element below-->
      <!--<SupportUrl DefaultValue="[Insert the URL of a page that provides support information for the app]" />-->

      <!-- 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>
      <AppDomain>AppDomain2</AppDomain>
      <AppDomain>AppDomain3</AppDomain>
      </AppDomains>
      <!--End Basic Settings. -->

      <Hosts>
      <Host Name="Mailbox" />
      </Hosts>
      <Requirements>
      <Sets>
      <Set Name="Mailbox" MinVersion="1.3" />
      </Sets>
      </Requirements>
      <FormSettings>
      <Form xsi:type="ItemRead">
      <DesktopSettings>
      <SourceLocation DefaultValue="https://localhost:3000/index.html"/>
      <RequestedHeight>250</RequestedHeight>
      </DesktopSettings>
      </Form>
      </FormSettings>

      <Permissions>ReadWriteItem</Permissions>
      <Rule xsi:type="RuleCollection" Mode="Or">
      <Rule xsi:type="ItemIs" ItemType="Message" FormType="Read" />
      </Rule>
      <DisableEntityHighlighting>false</DisableEntityHighlighting>

      <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
      <Requirements>
      <bt:Sets DefaultMinVersion="1.3">
      <bt:Set Name="Mailbox" />
      </bt:Sets>
      </Requirements>
      <Hosts>
      <Host xsi:type="MailHost">

      <DesktopFormFactor>
      <!-- Location of the Functions that UI-less buttons can trigger (ExecuteFunction Actions). -->
      <FunctionFile resid="functionFile" />

      <!-- Message Read -->
      <ExtensionPoint xsi:type="MessageReadCommandSurface">
      <!-- Use the default tab of the ExtensionPoint or create your own with <CustomTab id="myTab"> -->
      <OfficeTab id="TabDefault">
      <!-- Up to 6 Groups added per Tab -->
      <Group id="msgReadGroup">
      <Label resid="groupLabel" />
      <!-- Function (UI-less) button -->
      <Control xsi:type="Button" id="eventTestButton">
      <Label resid="funcComposeButtonLabel" />
      <Supertip>
      <Title resid="funcComposeSuperTipTitle" />
      <Description resid="funcComposeSuperTipDescription" />
      </Supertip>
      <Icon>
      <bt:Image size="16" resid="icon16" />
      <bt:Image size="32" resid="icon32" />
      <bt:Image size="80" resid="icon80" />
      </Icon>
      <Action xsi:type="ExecuteFunction">
      <FunctionName>testEventObject</FunctionName>
      </Action>
      </Control>
      <!-- Go to http://aka.ms/ButtonCommands to learn how to add more Controls: ExecuteFunction and Menu -->
      </Group>
      </OfficeTab>
      </ExtensionPoint>
      <!-- Go to http://aka.ms/ExtensionPointsCommands to learn how to add more Extension Points: MessageRead, AppointmentOrganizer, AppointmentAttendee -->
      </DesktopFormFactor>
      </Host>
      </Hosts>

      <Resources>
      <bt:Images>
      <bt:Image id="icon16" DefaultValue="https://localhost:3000/assets/icon-16.png"/>
      <bt:Image id="icon32" DefaultValue="https://localhost:3000/assets/icon-32.png"/>
      <bt:Image id="icon80" DefaultValue="https://localhost:3000/assets/icon-80.png"/>
      </bt:Images>
      <bt:Urls>
      <bt:Url id="functionFile" DefaultValue="https://localhost:3000/function-file/function-file.html"/>
      <bt:Url id="messageReadTaskPaneUrl" DefaultValue="https://localhost:3000/index.html"/>
      </bt:Urls>
      <bt:ShortStrings>
      <bt:String id="groupLabel" DefaultValue="Test Add-in Group"/>
      <bt:String id="funcComposeButtonLabel" DefaultValue="Test Tab"/>
      <bt:String id="funcComposeSuperTipTitle" DefaultValue="Execute the test that's been setup"/>
      </bt:ShortStrings>
      <bt:LongStrings>
      <bt:String id="funcComposeSuperTipDescription" DefaultValue="Does something, something expected..."/>
      </bt:LongStrings>
      </Resources>
      </VersionOverrides>
      </OfficeApp>


      function-file.js:



      // The initialize function must be run each time a new page is loaded
      Office.initialize = reason => {
      console.log('Office init...' + reason);
      };

      // Add any ui-less function here
      function testEventObject(event) {
      var buttonId = event.source.id;
      console.log('testEventObject() called, buttonID: ' + buttonId);
      event.complete();
      }


      What I actually get:



      Browser Console Log



      Hopefully something simple I'm missing!










      share|improve this question














      Following the documentation in several places [mostly on Microsoft here: https://docs.microsoft.com/en-us/javascript/api/office/office.addincommands.event?view=office-js and here: https://docs.microsoft.com/en-us/outlook/add-ins/add-in-commands-for-outlook but also from various searches etc] I am unable to get the UI Less Functions to work in Outlook Desktop or Outlook Web Access.



      Both appear to call the function-file as I can test that and successfully see output from the Office.Initilize function. But I can never get the actual named function to call at all.



      I've seen lots of examples and can't find anyone else complaining that it doesn't work so must be doing something wrong but I can't spot the fault:



      Manifest:



      <?xml version="1.0" encoding="UTF-8"?>
      <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:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0"
      xsi:type="MailApp">

      <!-- Begin Basic Settings: Add-in metadata, used for all versions of Office unless override provided. -->

      <!-- IMPORTANT! Id must be unique for your add-in, if you reuse this manifest ensure that you change this id to a new GUID. -->
      <Id>e540c7ff-41e8-47a2-b2ae-7e3cae3336bc</Id>

      <!--Version. Updates from the store only get triggered if there is a version change. -->
      <Version>1.0.0.2</Version>
      <ProviderName>[Provider name]</ProviderName>
      <DefaultLocale>en-US</DefaultLocale>
      <!-- The display name of your add-in. Used on the store and various places of the Office UI such as the add-ins dialog. -->
      <DisplayName DefaultValue="FunctionExecuteTest" />
      <Description DefaultValue="[Outlook Add-in description]"/>

      <!-- Icon for your add-in. Used on installation screens and the add-ins dialog. -->
      <IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png" />
      <HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/hi-res-icon.png"/>

      <!--If you plan to submit this add-in to the Office Store, uncomment the SupportUrl element below-->
      <!--<SupportUrl DefaultValue="[Insert the URL of a page that provides support information for the app]" />-->

      <!-- 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>
      <AppDomain>AppDomain2</AppDomain>
      <AppDomain>AppDomain3</AppDomain>
      </AppDomains>
      <!--End Basic Settings. -->

      <Hosts>
      <Host Name="Mailbox" />
      </Hosts>
      <Requirements>
      <Sets>
      <Set Name="Mailbox" MinVersion="1.3" />
      </Sets>
      </Requirements>
      <FormSettings>
      <Form xsi:type="ItemRead">
      <DesktopSettings>
      <SourceLocation DefaultValue="https://localhost:3000/index.html"/>
      <RequestedHeight>250</RequestedHeight>
      </DesktopSettings>
      </Form>
      </FormSettings>

      <Permissions>ReadWriteItem</Permissions>
      <Rule xsi:type="RuleCollection" Mode="Or">
      <Rule xsi:type="ItemIs" ItemType="Message" FormType="Read" />
      </Rule>
      <DisableEntityHighlighting>false</DisableEntityHighlighting>

      <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
      <Requirements>
      <bt:Sets DefaultMinVersion="1.3">
      <bt:Set Name="Mailbox" />
      </bt:Sets>
      </Requirements>
      <Hosts>
      <Host xsi:type="MailHost">

      <DesktopFormFactor>
      <!-- Location of the Functions that UI-less buttons can trigger (ExecuteFunction Actions). -->
      <FunctionFile resid="functionFile" />

      <!-- Message Read -->
      <ExtensionPoint xsi:type="MessageReadCommandSurface">
      <!-- Use the default tab of the ExtensionPoint or create your own with <CustomTab id="myTab"> -->
      <OfficeTab id="TabDefault">
      <!-- Up to 6 Groups added per Tab -->
      <Group id="msgReadGroup">
      <Label resid="groupLabel" />
      <!-- Function (UI-less) button -->
      <Control xsi:type="Button" id="eventTestButton">
      <Label resid="funcComposeButtonLabel" />
      <Supertip>
      <Title resid="funcComposeSuperTipTitle" />
      <Description resid="funcComposeSuperTipDescription" />
      </Supertip>
      <Icon>
      <bt:Image size="16" resid="icon16" />
      <bt:Image size="32" resid="icon32" />
      <bt:Image size="80" resid="icon80" />
      </Icon>
      <Action xsi:type="ExecuteFunction">
      <FunctionName>testEventObject</FunctionName>
      </Action>
      </Control>
      <!-- Go to http://aka.ms/ButtonCommands to learn how to add more Controls: ExecuteFunction and Menu -->
      </Group>
      </OfficeTab>
      </ExtensionPoint>
      <!-- Go to http://aka.ms/ExtensionPointsCommands to learn how to add more Extension Points: MessageRead, AppointmentOrganizer, AppointmentAttendee -->
      </DesktopFormFactor>
      </Host>
      </Hosts>

      <Resources>
      <bt:Images>
      <bt:Image id="icon16" DefaultValue="https://localhost:3000/assets/icon-16.png"/>
      <bt:Image id="icon32" DefaultValue="https://localhost:3000/assets/icon-32.png"/>
      <bt:Image id="icon80" DefaultValue="https://localhost:3000/assets/icon-80.png"/>
      </bt:Images>
      <bt:Urls>
      <bt:Url id="functionFile" DefaultValue="https://localhost:3000/function-file/function-file.html"/>
      <bt:Url id="messageReadTaskPaneUrl" DefaultValue="https://localhost:3000/index.html"/>
      </bt:Urls>
      <bt:ShortStrings>
      <bt:String id="groupLabel" DefaultValue="Test Add-in Group"/>
      <bt:String id="funcComposeButtonLabel" DefaultValue="Test Tab"/>
      <bt:String id="funcComposeSuperTipTitle" DefaultValue="Execute the test that's been setup"/>
      </bt:ShortStrings>
      <bt:LongStrings>
      <bt:String id="funcComposeSuperTipDescription" DefaultValue="Does something, something expected..."/>
      </bt:LongStrings>
      </Resources>
      </VersionOverrides>
      </OfficeApp>


      function-file.js:



      // The initialize function must be run each time a new page is loaded
      Office.initialize = reason => {
      console.log('Office init...' + reason);
      };

      // Add any ui-less function here
      function testEventObject(event) {
      var buttonId = event.source.id;
      console.log('testEventObject() called, buttonID: ' + buttonId);
      event.complete();
      }


      What I actually get:



      Browser Console Log



      Hopefully something simple I'm missing!







      web outlook add-in






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 22 '18 at 12:48









      Will BlackburnWill Blackburn

      73




      73
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Per documentation on FunctionFile element, event should call method completed(). The function you have posted has syntax error as it calls to event.complete();. This needs to be addressed.



          The functionFile element pointed to "https://localhost:3000/function-file/function-file.html", but script snapshot in the description is for function-file.js. Please check you are correctly included JS file into your HTML file. For example, if you used absolute URI to the resource it has to start with https (SSL). Also, try to leave inside this JS file only functions you need, to avoid any other JS errors.






          share|improve this answer


























          • Apologies for the delayed response, I've tried correcting the typo (thanks for the spot!) but it's still not resolve the fault. I even tried making the call simpler by just having the function contain - note that I also changed the parameter name to make sure it wasn't something getting in the way of that: function testEventObject(result) { console.log("Function fired"); result.completed(); } I even tried just calling 'completed()' without result but still I get the Office.initialize call but nothing else

            – Will Blackburn
            Nov 27 '18 at 15:39













          • @WillBlackburn functionFile element pointed to https://localhost:3000/function-file/function-file.html, but script snapshot is for function-file.js. Are you correctly included JS file into your HTML file? For example, if you used absolute URI to the resource it has to start with https (SSL). Try to leave inside this JS file only functions you need to avoid any other JS errors.

            – Slava Ivanov
            Nov 27 '18 at 16:17











          • It's built via WebPack, but the js file is embedded correctly in to the HTML page... However I think you've hit the problem on the head as the debug console shows another call to the js file which is directly to the domain path instead of in function-file... I'm investigating now and will update as soon as I have a full answer! Thank you so far for your help!

            – Will Blackburn
            Nov 27 '18 at 16:26











          • I've sorted it, if you update your answer to include not only the typo but also the fact that the function-file.js wasn't referenced correctly I'll mark it as the accepted answer. Really appreciate your time on getting this resolved, thank you

            – Will Blackburn
            Nov 27 '18 at 16:34











          • @WillBlackburn I have updated the answer, glad it worked out for you. Best regards.

            – Slava Ivanov
            Nov 27 '18 at 16:39











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431411%2foutlook-web-add-in-not-executing-named-function%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Per documentation on FunctionFile element, event should call method completed(). The function you have posted has syntax error as it calls to event.complete();. This needs to be addressed.



          The functionFile element pointed to "https://localhost:3000/function-file/function-file.html", but script snapshot in the description is for function-file.js. Please check you are correctly included JS file into your HTML file. For example, if you used absolute URI to the resource it has to start with https (SSL). Also, try to leave inside this JS file only functions you need, to avoid any other JS errors.






          share|improve this answer


























          • Apologies for the delayed response, I've tried correcting the typo (thanks for the spot!) but it's still not resolve the fault. I even tried making the call simpler by just having the function contain - note that I also changed the parameter name to make sure it wasn't something getting in the way of that: function testEventObject(result) { console.log("Function fired"); result.completed(); } I even tried just calling 'completed()' without result but still I get the Office.initialize call but nothing else

            – Will Blackburn
            Nov 27 '18 at 15:39













          • @WillBlackburn functionFile element pointed to https://localhost:3000/function-file/function-file.html, but script snapshot is for function-file.js. Are you correctly included JS file into your HTML file? For example, if you used absolute URI to the resource it has to start with https (SSL). Try to leave inside this JS file only functions you need to avoid any other JS errors.

            – Slava Ivanov
            Nov 27 '18 at 16:17











          • It's built via WebPack, but the js file is embedded correctly in to the HTML page... However I think you've hit the problem on the head as the debug console shows another call to the js file which is directly to the domain path instead of in function-file... I'm investigating now and will update as soon as I have a full answer! Thank you so far for your help!

            – Will Blackburn
            Nov 27 '18 at 16:26











          • I've sorted it, if you update your answer to include not only the typo but also the fact that the function-file.js wasn't referenced correctly I'll mark it as the accepted answer. Really appreciate your time on getting this resolved, thank you

            – Will Blackburn
            Nov 27 '18 at 16:34











          • @WillBlackburn I have updated the answer, glad it worked out for you. Best regards.

            – Slava Ivanov
            Nov 27 '18 at 16:39
















          0














          Per documentation on FunctionFile element, event should call method completed(). The function you have posted has syntax error as it calls to event.complete();. This needs to be addressed.



          The functionFile element pointed to "https://localhost:3000/function-file/function-file.html", but script snapshot in the description is for function-file.js. Please check you are correctly included JS file into your HTML file. For example, if you used absolute URI to the resource it has to start with https (SSL). Also, try to leave inside this JS file only functions you need, to avoid any other JS errors.






          share|improve this answer


























          • Apologies for the delayed response, I've tried correcting the typo (thanks for the spot!) but it's still not resolve the fault. I even tried making the call simpler by just having the function contain - note that I also changed the parameter name to make sure it wasn't something getting in the way of that: function testEventObject(result) { console.log("Function fired"); result.completed(); } I even tried just calling 'completed()' without result but still I get the Office.initialize call but nothing else

            – Will Blackburn
            Nov 27 '18 at 15:39













          • @WillBlackburn functionFile element pointed to https://localhost:3000/function-file/function-file.html, but script snapshot is for function-file.js. Are you correctly included JS file into your HTML file? For example, if you used absolute URI to the resource it has to start with https (SSL). Try to leave inside this JS file only functions you need to avoid any other JS errors.

            – Slava Ivanov
            Nov 27 '18 at 16:17











          • It's built via WebPack, but the js file is embedded correctly in to the HTML page... However I think you've hit the problem on the head as the debug console shows another call to the js file which is directly to the domain path instead of in function-file... I'm investigating now and will update as soon as I have a full answer! Thank you so far for your help!

            – Will Blackburn
            Nov 27 '18 at 16:26











          • I've sorted it, if you update your answer to include not only the typo but also the fact that the function-file.js wasn't referenced correctly I'll mark it as the accepted answer. Really appreciate your time on getting this resolved, thank you

            – Will Blackburn
            Nov 27 '18 at 16:34











          • @WillBlackburn I have updated the answer, glad it worked out for you. Best regards.

            – Slava Ivanov
            Nov 27 '18 at 16:39














          0












          0








          0







          Per documentation on FunctionFile element, event should call method completed(). The function you have posted has syntax error as it calls to event.complete();. This needs to be addressed.



          The functionFile element pointed to "https://localhost:3000/function-file/function-file.html", but script snapshot in the description is for function-file.js. Please check you are correctly included JS file into your HTML file. For example, if you used absolute URI to the resource it has to start with https (SSL). Also, try to leave inside this JS file only functions you need, to avoid any other JS errors.






          share|improve this answer















          Per documentation on FunctionFile element, event should call method completed(). The function you have posted has syntax error as it calls to event.complete();. This needs to be addressed.



          The functionFile element pointed to "https://localhost:3000/function-file/function-file.html", but script snapshot in the description is for function-file.js. Please check you are correctly included JS file into your HTML file. For example, if you used absolute URI to the resource it has to start with https (SSL). Also, try to leave inside this JS file only functions you need, to avoid any other JS errors.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 27 '18 at 16:39

























          answered Nov 22 '18 at 14:25









          Slava IvanovSlava Ivanov

          4,11321528




          4,11321528













          • Apologies for the delayed response, I've tried correcting the typo (thanks for the spot!) but it's still not resolve the fault. I even tried making the call simpler by just having the function contain - note that I also changed the parameter name to make sure it wasn't something getting in the way of that: function testEventObject(result) { console.log("Function fired"); result.completed(); } I even tried just calling 'completed()' without result but still I get the Office.initialize call but nothing else

            – Will Blackburn
            Nov 27 '18 at 15:39













          • @WillBlackburn functionFile element pointed to https://localhost:3000/function-file/function-file.html, but script snapshot is for function-file.js. Are you correctly included JS file into your HTML file? For example, if you used absolute URI to the resource it has to start with https (SSL). Try to leave inside this JS file only functions you need to avoid any other JS errors.

            – Slava Ivanov
            Nov 27 '18 at 16:17











          • It's built via WebPack, but the js file is embedded correctly in to the HTML page... However I think you've hit the problem on the head as the debug console shows another call to the js file which is directly to the domain path instead of in function-file... I'm investigating now and will update as soon as I have a full answer! Thank you so far for your help!

            – Will Blackburn
            Nov 27 '18 at 16:26











          • I've sorted it, if you update your answer to include not only the typo but also the fact that the function-file.js wasn't referenced correctly I'll mark it as the accepted answer. Really appreciate your time on getting this resolved, thank you

            – Will Blackburn
            Nov 27 '18 at 16:34











          • @WillBlackburn I have updated the answer, glad it worked out for you. Best regards.

            – Slava Ivanov
            Nov 27 '18 at 16:39



















          • Apologies for the delayed response, I've tried correcting the typo (thanks for the spot!) but it's still not resolve the fault. I even tried making the call simpler by just having the function contain - note that I also changed the parameter name to make sure it wasn't something getting in the way of that: function testEventObject(result) { console.log("Function fired"); result.completed(); } I even tried just calling 'completed()' without result but still I get the Office.initialize call but nothing else

            – Will Blackburn
            Nov 27 '18 at 15:39













          • @WillBlackburn functionFile element pointed to https://localhost:3000/function-file/function-file.html, but script snapshot is for function-file.js. Are you correctly included JS file into your HTML file? For example, if you used absolute URI to the resource it has to start with https (SSL). Try to leave inside this JS file only functions you need to avoid any other JS errors.

            – Slava Ivanov
            Nov 27 '18 at 16:17











          • It's built via WebPack, but the js file is embedded correctly in to the HTML page... However I think you've hit the problem on the head as the debug console shows another call to the js file which is directly to the domain path instead of in function-file... I'm investigating now and will update as soon as I have a full answer! Thank you so far for your help!

            – Will Blackburn
            Nov 27 '18 at 16:26











          • I've sorted it, if you update your answer to include not only the typo but also the fact that the function-file.js wasn't referenced correctly I'll mark it as the accepted answer. Really appreciate your time on getting this resolved, thank you

            – Will Blackburn
            Nov 27 '18 at 16:34











          • @WillBlackburn I have updated the answer, glad it worked out for you. Best regards.

            – Slava Ivanov
            Nov 27 '18 at 16:39

















          Apologies for the delayed response, I've tried correcting the typo (thanks for the spot!) but it's still not resolve the fault. I even tried making the call simpler by just having the function contain - note that I also changed the parameter name to make sure it wasn't something getting in the way of that: function testEventObject(result) { console.log("Function fired"); result.completed(); } I even tried just calling 'completed()' without result but still I get the Office.initialize call but nothing else

          – Will Blackburn
          Nov 27 '18 at 15:39







          Apologies for the delayed response, I've tried correcting the typo (thanks for the spot!) but it's still not resolve the fault. I even tried making the call simpler by just having the function contain - note that I also changed the parameter name to make sure it wasn't something getting in the way of that: function testEventObject(result) { console.log("Function fired"); result.completed(); } I even tried just calling 'completed()' without result but still I get the Office.initialize call but nothing else

          – Will Blackburn
          Nov 27 '18 at 15:39















          @WillBlackburn functionFile element pointed to https://localhost:3000/function-file/function-file.html, but script snapshot is for function-file.js. Are you correctly included JS file into your HTML file? For example, if you used absolute URI to the resource it has to start with https (SSL). Try to leave inside this JS file only functions you need to avoid any other JS errors.

          – Slava Ivanov
          Nov 27 '18 at 16:17





          @WillBlackburn functionFile element pointed to https://localhost:3000/function-file/function-file.html, but script snapshot is for function-file.js. Are you correctly included JS file into your HTML file? For example, if you used absolute URI to the resource it has to start with https (SSL). Try to leave inside this JS file only functions you need to avoid any other JS errors.

          – Slava Ivanov
          Nov 27 '18 at 16:17













          It's built via WebPack, but the js file is embedded correctly in to the HTML page... However I think you've hit the problem on the head as the debug console shows another call to the js file which is directly to the domain path instead of in function-file... I'm investigating now and will update as soon as I have a full answer! Thank you so far for your help!

          – Will Blackburn
          Nov 27 '18 at 16:26





          It's built via WebPack, but the js file is embedded correctly in to the HTML page... However I think you've hit the problem on the head as the debug console shows another call to the js file which is directly to the domain path instead of in function-file... I'm investigating now and will update as soon as I have a full answer! Thank you so far for your help!

          – Will Blackburn
          Nov 27 '18 at 16:26













          I've sorted it, if you update your answer to include not only the typo but also the fact that the function-file.js wasn't referenced correctly I'll mark it as the accepted answer. Really appreciate your time on getting this resolved, thank you

          – Will Blackburn
          Nov 27 '18 at 16:34





          I've sorted it, if you update your answer to include not only the typo but also the fact that the function-file.js wasn't referenced correctly I'll mark it as the accepted answer. Really appreciate your time on getting this resolved, thank you

          – Will Blackburn
          Nov 27 '18 at 16:34













          @WillBlackburn I have updated the answer, glad it worked out for you. Best regards.

          – Slava Ivanov
          Nov 27 '18 at 16:39





          @WillBlackburn I have updated the answer, glad it worked out for you. Best regards.

          – Slava Ivanov
          Nov 27 '18 at 16:39


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431411%2foutlook-web-add-in-not-executing-named-function%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          404 Error Contact Form 7 ajax form submitting

          How to know if a Active Directory user can login interactively

          Refactoring coordinates for Minecraft Pi buildings written in Python