File tree Expand file tree Collapse file tree 3 files changed +51
-7
lines changed Expand file tree Collapse file tree 3 files changed +51
-7
lines changed Original file line number Diff line number Diff line change 66
66
<SourceLocation resid =" Taskpane.Url" />
67
67
</Action >
68
68
</Control >
69
+ <Control xsi : type =" Button" id =" ActionButton" >
70
+ <Label resid =" ActionButton.Label" />
71
+ <Supertip >
72
+ <Title resid =" ActionButton.Label" />
73
+ <Description resid =" ActionButton.Tooltip" />
74
+ </Supertip >
75
+ <Icon >
76
+ <bt : Image size =" 16" resid =" Icon.16x16" />
77
+ <bt : Image size =" 32" resid =" Icon.32x32" />
78
+ <bt : Image size =" 80" resid =" Icon.80x80" />
79
+ </Icon >
80
+ <Action xsi : type =" ExecuteFunction" >
81
+ <FunctionName >action</FunctionName >
82
+ </Action >
83
+ </Control >
69
84
</Group >
70
85
</OfficeTab >
71
86
</ExtensionPoint >
85
100
<bt : ShortStrings >
86
101
<bt : String id =" GroupLabel" DefaultValue =" Contoso Add-in" />
87
102
<bt : String id =" TaskpaneButton.Label" DefaultValue =" Show Taskpane" />
103
+ <bt : String id =" ActionButton.Label" DefaultValue =" Perform an action" />
88
104
</bt : ShortStrings >
89
105
<bt : LongStrings >
90
106
<bt : String id =" TaskpaneButton.Tooltip" DefaultValue =" Opens a pane displaying all available properties." />
107
+ <bt : String id =" ActionButton.Tooltip" DefaultValue =" Perform an action when clicked." />
91
108
</bt : LongStrings >
92
109
</Resources >
93
110
</VersionOverrides >
Original file line number Diff line number Diff line change 3
3
* See LICENSE in the project root for license information.
4
4
*/
5
5
6
- ( ( ) => {
7
- // The initialize function must be run each time a new page is loaded
8
- Office . initialize = ( ) => {
6
+ Office . onReady ( info => {
7
+ // If needed, Office.js is ready to be called
8
+ } ) ;
9
9
10
- } ;
10
+ /**
11
+ * Shows a notification when the add-in command is executed.
12
+ * @param event
13
+ */
14
+ function action ( event : Office . AddinCommands . Event ) {
15
+ const message : Office . NotificationMessageDetails = {
16
+ type : Office . MailboxEnums . ItemNotificationMessageType . InformationalMessage ,
17
+ message : "Performed action." ,
18
+ icon : "Icon.80x80" ,
19
+ persistent : true
20
+ }
21
+
22
+ // Show a notification message
23
+ Office . context . mailbox . item . notificationMessages . replaceAsync ( "action" , message ) ;
24
+
25
+ // Be sure to indicate when the add-in command function is complete
26
+ event . completed ( ) ;
27
+ }
28
+
29
+ function getGlobal ( ) {
30
+ return ( typeof self !== "undefined" ) ? self :
31
+ ( typeof window !== "undefined" ) ? window :
32
+ ( typeof global !== "undefined" ) ? global :
33
+ undefined ;
34
+ }
35
+
36
+ const g = getGlobal ( ) as any ;
11
37
12
- // Add any ui-less function here
13
- } ) ( ) ;
38
+ // the add-in command functions need to be available in global scope
39
+ g . action = action ;
Original file line number Diff line number Diff line change @@ -64,7 +64,8 @@ module.exports = async (env, options) => {
64
64
"Access-Control-Allow-Origin" : "*"
65
65
} ,
66
66
https : await devCerts . getHttpsServerOptions ( ) ,
67
- port : 3000
67
+ port : 3000 ,
68
+ writeToDisk : true
68
69
}
69
70
} ;
70
71
You can’t perform that action at this time.
0 commit comments