Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding code snippet example of the new sendAsync API #950

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions playlists-prod/outlook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,15 @@
group: Preview APIs
api_set:
Mailbox: preview
- id: outlook-send-async
name: Send the current message or appointment (Compose)
fileName: send-async.yaml
description: Send the current message or appointment.
rawUrl: >-
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/99-preview-apis/send-async.yaml
group: Preview APIs
api_set:
Mailbox: preview
- id: outlook-set-displayed-body-subject
name: Temporarily set the body or subject displayed in a message (Message Read)
fileName: set-displayed-body-subject.yaml
Expand Down
9 changes: 9 additions & 0 deletions playlists/outlook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,15 @@
group: Preview APIs
api_set:
Mailbox: preview
- id: outlook-send-async
name: Send the current message or appointment (Compose)
fileName: send-async.yaml
description: Send the current message or appointment.
rawUrl: >-
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/outlook/99-preview-apis/send-async.yaml
group: Preview APIs
api_set:
Mailbox: preview
- id: outlook-set-displayed-body-subject
name: Temporarily set the body or subject displayed in a message (Message Read)
fileName: set-displayed-body-subject.yaml
Expand Down
60 changes: 60 additions & 0 deletions samples/outlook/99-preview-apis/send-async.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
order: 2
id: outlook-send-async
name: Send the current message or appointment (Compose)
description: Sends the current message or appointment.
host: OUTLOOK
api_set:
Mailbox: preview
script:
content: |
$("#send-async").on("click", sendAsync);

function sendAsync() {
// This snippet sends the current message or appointment being composed.
Office.context.mailbox.item.sendAsync((asyncResult) => {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
console.log("Action failed with error: " + asyncResult.error.message);
return;
}
});
}
language: typescript
template:
content: |-
<section class="ms-Fabric ms-font-m">
<p class="ms-font-m">This sample shows how to programmatically send the current message or appointment being composed.</p>
<p><b>Required mode</b>: Compose</p>
</section>

<section class="ms-Fabric samples ms-font-m">
<h3>Try it out</h3>
<button id="send-async" class="ms-Button">
<span class="ms-Button-label">Send</span>
</button>
</section>
language: html
style:
content: |-
section.samples {
margin-top: 20px;
}

section.samples .ms-Button, section.setup .ms-Button {
display: block;
margin-bottom: 5px;
margin-left: 20px;
min-width: 80px;
}
language: css
libraries: |-
https://appsforoffice.microsoft.com/lib/beta/hosted/office.js
@types/office-js-preview

[email protected]/dist/css/fabric.min.css
[email protected]/dist/css/fabric.components.min.css

[email protected]/client/core.min.js
@types/core-js

[email protected]
@types/[email protected]
1 change: 1 addition & 0 deletions view-prod/outlook.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,6 @@
"outlook-get-item-class-async": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-item-class-async.yaml",
"outlook-other-item-apis-item-id-compose": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/item-id-compose.yaml",
"outlook-get-set-isalldayevent": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/99-preview-apis/get-set-isalldayevent.yaml",
"outlook-send-async": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/99-preview-apis/send-async.yaml",
"outlook-set-displayed-body-subject": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/99-preview-apis/set-displayed-body-subject.yaml"
}
1 change: 1 addition & 0 deletions view/outlook.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,6 @@
"outlook-get-item-class-async": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/outlook/90-other-item-apis/get-item-class-async.yaml",
"outlook-other-item-apis-item-id-compose": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/outlook/90-other-item-apis/item-id-compose.yaml",
"outlook-get-set-isalldayevent": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/outlook/99-preview-apis/get-set-isalldayevent.yaml",
"outlook-send-async": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/outlook/99-preview-apis/send-async.yaml",
"outlook-set-displayed-body-subject": "https://raw.githubusercontent.com/OfficeDev/office-js-snippets/main/samples/outlook/99-preview-apis/set-displayed-body-subject.yaml"
}