Skip to content

Commit

Permalink
[All hosts] (dialog) Add code snippet (#2116)
Browse files Browse the repository at this point in the history
* Add snippet to messageChild

* Apply suggestion from review
  • Loading branch information
samantharamon authored Oct 29, 2024
1 parent 6e316dd commit 7c72f87
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 1 deletion.
16 changes: 16 additions & 0 deletions docs/code-snippets/office-snippets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1817,6 +1817,22 @@ Office.Dialog#close:member(1):
});
}
);
Office.Dialog#messageChild:member(1):
- |-
// The following example shows how to send information about the current active worksheet to the dialog.
await Excel.run(async (context) => {
const worksheet = context.workbook.worksheets.getActiveWorksheet();
worksheet.load();
await context.sync();
worksheetPropertiesChanged(worksheet);
});
...
function worksheetPropertiesChanged(currentWorksheet) {
const messageToDialog = JSON.stringify(currentWorksheet);
dialog.messageChild(messageToDialog);
}
Office.DialogOptions#height:member:
- |-
// The following example shows how to open a dialog with a specified size. It also shows
Expand Down
26 changes: 26 additions & 0 deletions docs/docs-ref-autogen/office/office/office.dialog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,32 @@ methods:
Although classic Outlook on Mac doesn't support Mailbox 1.9, it does support DialogApi 1.2.
#### Examples
```TypeScript
// The following example shows how to send information about the current active worksheet to the dialog.
await Excel.run(async (context) => {
const worksheet = context.workbook.worksheets.getActiveWorksheet();
worksheet.load();
await context.sync();
worksheetPropertiesChanged(worksheet);
});
...
function worksheetPropertiesChanged(currentWorksheet) {
const messageToDialog = JSON.stringify(currentWorksheet);
dialog.messageChild(messageToDialog);
}
```
isPreview: false
isDeprecated: false
syntax:
Expand Down
26 changes: 26 additions & 0 deletions docs/docs-ref-autogen/office_release/office/office.dialog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,32 @@ methods:
Although classic Outlook on Mac doesn't support Mailbox 1.9, it does support DialogApi 1.2.
#### Examples
```TypeScript
// The following example shows how to send information about the current active worksheet to the dialog.
await Excel.run(async (context) => {
const worksheet = context.workbook.worksheets.getActiveWorksheet();
worksheet.load();
await context.sync();
worksheetPropertiesChanged(worksheet);
});
...
function worksheetPropertiesChanged(currentWorksheet) {
const messageToDialog = JSON.stringify(currentWorksheet);
dialog.messageChild(messageToDialog);
}
```
isPreview: false
isDeprecated: false
syntax:
Expand Down
2 changes: 1 addition & 1 deletion generate-docs/API Coverage Report.csv
Original file line number Diff line number Diff line change
Expand Up @@ -6815,7 +6815,7 @@ Office.DevicePermissionType,"microphone",EnumField,Fine,false
Office.Dialog,N/A,Class,Good,false
Office.Dialog,"addEventHandler(eventType, handler)",Method,Fine,true
Office.Dialog,"close()",Method,Good,true
Office.Dialog,"messageChild(message, messageOptions)",Method,Fine,false
Office.Dialog,"messageChild(message, messageOptions)",Method,Fine,true
Office.Dialog,"sendMessage(name)",Method,Poor,false
Office.DialogMessageOptions,N/A,Class,Good,false
Office.DialogMessageOptions,"targetOrigin",Property,Good,false
Expand Down
16 changes: 16 additions & 0 deletions generate-docs/script-inputs/local-repo-snippets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3358,6 +3358,22 @@ Office.Dialog#close:member(1):
});
}
);
Office.Dialog#messageChild:member(1):
- |-
// The following example shows how to send information about the current active worksheet to the dialog.
await Excel.run(async (context) => {
const worksheet = context.workbook.worksheets.getActiveWorksheet();
worksheet.load();
await context.sync();
worksheetPropertiesChanged(worksheet);
});
...
function worksheetPropertiesChanged(currentWorksheet) {
const messageToDialog = JSON.stringify(currentWorksheet);
dialog.messageChild(messageToDialog);
}
Office.DialogOptions#height:member:
- |-
// The following example shows how to open a dialog with a specified size. It also shows
Expand Down

0 comments on commit 7c72f87

Please sign in to comment.