Termite_nest
Termite_nest

Reputation: 11

Run a Javascript function from an Outlook Add-in Manifest file

I've setup an Outlook Add-in using an XML manifest file. I've got some buttons appearing in a menu drop down on the UI. When I click the buttons it says my request is being worked on and does nothing (I'm expecting message boxes on the click of these) Screen grab of buttons I've tried checking all the references and files involved. Double-checked the xml for the button, function is ShowAlert1:

<DesktopFormFactor>
            <FunctionFile resid="functionFile" />

            <!-- Message compose form -->
            <ExtensionPoint xsi:type="MessageComposeCommandSurface">
              <OfficeTab id="TabDefault">
                <Group id="msgComposeDemoGroup">
                  <Label resid="groupLabel" />
                  <!-- Function (UI-less) button -->
                <Control xsi:type="Button" id="msgComposeFunctionButton1">
                  <Label resid="funcComposeButtonLabel" />
                  <Supertip>
                    <Title resid="funcComposeSuperTipTitle" />
                    <Description resid="funcComposeSuperTipDescription" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="blue-icon-16" />
                    <bt:Image size="32" resid="blue-icon-32" />
                    <bt:Image size="80" resid="blue-icon-80" />
                  </Icon>
                  <Action xsi:type="ExecuteFunction">
                    <FunctionName>showAlert1</FunctionName>
                  </Action>
                </Control>

My function file is:

<bt:Url id="functionFile" DefaultValue="https://localhost:3000/Functions.html"/>

Within Functions.html is the ref to the js file with my function:

<script src="Functions.js" type="text/javascript"></script>

and finally the Functions.js has my function def:

function showAlert1() {
    alert("This is an alert box!");
    
    event.completed();
}

ALL three of these files, the manifest, the functions.html and functions.js are in the same folder. I'm running a localhost and it hasn't complained in red about any of these files....
Can someone help to debug this or am I doing something obviously wrong?

Upvotes: 1

Views: 58

Answers (1)

Termite_nest
Termite_nest

Reputation: 11

I had an error in the js file, specifically: Office.actions.associate wasn't completed properly.

Upvotes: 0

Related Questions