Skip to content
Closed
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
21 changes: 19 additions & 2 deletions config/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const defaultApiSets = {

/* any other hosts is allowed to have no API sets specified*/
};

const outlookEndpoints = ['messageread', 'messagecompose', 'appointmentread', 'appointmentcompose'];

(async () => {
let processedSnippets = new Dictionary<SnippetProcessedData>();
Expand Down Expand Up @@ -154,7 +154,8 @@ async function processSnippets(processedSnippets: Dictionary<SnippetProcessedDat
group: groupName,
order: (typeof (snippet as any).order === 'undefined') ? 100 /* nominally 100 */ : (snippet as any).order,
api_set: snippet.api_set,
isPublic: file.isPublic
isPublic: file.isPublic,
endpoints: snippet.endpoints
};
} catch (exception) {
messages.push(exception);
Expand Down Expand Up @@ -527,6 +528,7 @@ async function generatePlaylists(processedSnippets: Dictionary<SnippetProcessedD
rawUrl: item.rawUrl,
group: item.group.replace(groupNumberRegex, '$2'),
api_set: item.api_set,
endpoints: item.endpoints,
};
});

Expand All @@ -538,6 +540,21 @@ async function generatePlaylists(processedSnippets: Dictionary<SnippetProcessedD
await writeFile(path.resolve(fileName), contents);

status.complete(true /*success*/, creatingStatusText);

if (host === 'outlook') {
await outlookEndpoints.map(async (endpoint) => {
const creatingStatusText = `Creating ${host}-${endpoint}.yaml`;
status.add(creatingStatusText);
let endpointItems = modifiedItems.filter((item) => item.endpoints.indexOf(endpoint) !== -1);
contents = jsyaml.safeDump(endpointItems, {
skipInvalid: true
});
fileName = `playlists/${host}-${endpoint}.yaml`;
await writeFile(path.resolve(fileName), contents);
status.complete(true /*success*/, creatingStatusText);
});
}

});

/* Creating view directory */
Expand Down
1 change: 1 addition & 0 deletions config/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface SnippetProcessedData {
[index: string]: number
};
isPublic: boolean;
endpoints?: string[];
}

/**
Expand Down
1 change: 1 addition & 0 deletions config/snippet.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface ITemplate {
name?: string;
description?: string;
author?: string;
endpoints?: string[];
host: string;
api_set: {
[index: string]: number
Expand Down
1 change: 1 addition & 0 deletions config/snippet.helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const snippetFields: { [key: string]: SnippetFieldType } = {
origin: SnippetFieldType.TRANSIENT,
created_at: SnippetFieldType.INTERNAL,
modified_at: SnippetFieldType.INTERNAL,
endpoints: SnippetFieldType.PUBLIC,

/* ISnippet */
script: SnippetFieldType.PUBLIC,
Expand Down
22 changes: 22 additions & 0 deletions playlists/outlook-appointmentcompose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- id: outlook-body-get-set-selected-text
name: Get/Set Selected Text
fileName: set-selected-text.yaml
description: Gets and Changes the value of selected text in body or subject.
rawUrl: >-
https://raw.githubusercontent.com/<ACCOUNT>/<REPO>/<BRANCH>/samples/outlook/01-body/set-selected-text.yaml
group: Body
api_set: {}
endpoints:
- messagecompose
- appointmentcompose
- id: outlook-subject-get-set-item-subject
name: Get/Set Item Subject
fileName: get-set-item-subject.yaml
description: Gets and Sets the subject of a compose item
rawUrl: >-
https://raw.githubusercontent.com/<ACCOUNT>/<REPO>/<BRANCH>/samples/outlook/02-subject/get-set-item-subject.yaml
group: Subject
api_set: {}
endpoints:
- messagecompose
- appointmentcompose
22 changes: 22 additions & 0 deletions playlists/outlook-appointmentread.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- id: outlook-body-get-selected-text
name: Get Selected Text
fileName: get-selected-text.yaml
description: Outputs the text selected from either the body or subject.
rawUrl: >-
https://raw.githubusercontent.com/<ACCOUNT>/<REPO>/<BRANCH>/samples/outlook/01-body/get-selected-text.yaml
group: Body
api_set: {}
endpoints:
- messageread
- appointmentread
- id: outlook-subject-get-item-subject
name: Get Item Subject
fileName: get-item-subject.yaml
description: Gets the subject of a compose item
rawUrl: >-
https://raw.githubusercontent.com/<ACCOUNT>/<REPO>/<BRANCH>/samples/outlook/02-subject/get-item-subject.yaml
group: Subject
api_set: {}
endpoints:
- messageread
- appointmentread
22 changes: 22 additions & 0 deletions playlists/outlook-messagecompose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- id: outlook-body-get-set-selected-text
name: Get/Set Selected Text
fileName: set-selected-text.yaml
description: Gets and Changes the value of selected text in body or subject.
rawUrl: >-
https://raw.githubusercontent.com/<ACCOUNT>/<REPO>/<BRANCH>/samples/outlook/01-body/set-selected-text.yaml
group: Body
api_set: {}
endpoints:
- messagecompose
- appointmentcompose
- id: outlook-subject-get-set-item-subject
name: Get/Set Item Subject
fileName: get-set-item-subject.yaml
description: Gets and Sets the subject of a compose item
rawUrl: >-
https://raw.githubusercontent.com/<ACCOUNT>/<REPO>/<BRANCH>/samples/outlook/02-subject/get-set-item-subject.yaml
group: Subject
api_set: {}
endpoints:
- messagecompose
- appointmentcompose
22 changes: 22 additions & 0 deletions playlists/outlook-messageread.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- id: outlook-body-get-selected-text
name: Get Selected Text
fileName: get-selected-text.yaml
description: Outputs the text selected from either the body or subject.
rawUrl: >-
https://raw.githubusercontent.com/<ACCOUNT>/<REPO>/<BRANCH>/samples/outlook/01-body/get-selected-text.yaml
group: Body
api_set: {}
endpoints:
- messageread
- appointmentread
- id: outlook-subject-get-item-subject
name: Get Item Subject
fileName: get-item-subject.yaml
description: Gets the subject of a compose item
rawUrl: >-
https://raw.githubusercontent.com/<ACCOUNT>/<REPO>/<BRANCH>/samples/outlook/02-subject/get-item-subject.yaml
group: Subject
api_set: {}
endpoints:
- messageread
- appointmentread
52 changes: 36 additions & 16 deletions playlists/outlook.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,44 @@
- id: outlook-compose-basics-get-item-subject
name: Get Item Subject
fileName: get-item-subject.yaml
description: Gets the subject of a compose item
rawUrl: >-
https://raw.githubusercontent.com/<ACCOUNT>/<REPO>/<BRANCH>/samples/outlook/01-compose-basics/get-item-subject.yaml
group: Compose Basics
api_set: {}
- id: outlook-compose-basics-get-selected-text
- id: outlook-body-get-selected-text
name: Get Selected Text
fileName: get-selected-text.yaml
description: Outputs the text selected from either the body or subject.
rawUrl: >-
https://raw.githubusercontent.com/<ACCOUNT>/<REPO>/<BRANCH>/samples/outlook/01-compose-basics/get-selected-text.yaml
group: Compose Basics
https://raw.githubusercontent.com/<ACCOUNT>/<REPO>/<BRANCH>/samples/outlook/01-body/get-selected-text.yaml
group: Body
api_set: {}
- id: outlook-compose-basics-set-selected-text
name: Set Selected Text
endpoints:
- messageread
- appointmentread
- id: outlook-body-get-set-selected-text
name: Get/Set Selected Text
fileName: set-selected-text.yaml
description: Changes the value of selected text in body or subject.
description: Gets and Changes the value of selected text in body or subject.
rawUrl: >-
https://raw.githubusercontent.com/<ACCOUNT>/<REPO>/<BRANCH>/samples/outlook/01-body/set-selected-text.yaml
group: Body
api_set: {}
endpoints:
- messagecompose
- appointmentcompose
- id: outlook-subject-get-item-subject
name: Get Item Subject
fileName: get-item-subject.yaml
description: Gets the subject of a compose item
rawUrl: >-
https://raw.githubusercontent.com/<ACCOUNT>/<REPO>/<BRANCH>/samples/outlook/02-subject/get-item-subject.yaml
group: Subject
api_set: {}
endpoints:
- messageread
- appointmentread
- id: outlook-subject-get-set-item-subject
name: Get/Set Item Subject
fileName: get-set-item-subject.yaml
description: Gets and Sets the subject of a compose item
rawUrl: >-
https://raw.githubusercontent.com/<ACCOUNT>/<REPO>/<BRANCH>/samples/outlook/01-compose-basics/set-selected-text.yaml
group: Compose Basics
https://raw.githubusercontent.com/<ACCOUNT>/<REPO>/<BRANCH>/samples/outlook/02-subject/get-set-item-subject.yaml
group: Subject
api_set: {}
endpoints:
- messagecompose
- appointmentcompose
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
id: outlook-compose-basics-get-selected-text
id: outlook-body-get-selected-text
name: Get Selected Text
description: Outputs the text selected from either the body or subject.
endpoints:
- messageread
- appointmentread
author: OfficeDev
host: OUTLOOK
api_set: {}
script:
Expand Down Expand Up @@ -30,8 +34,8 @@ style:
/* Your style goes here */
language: css
libraries: |
https://unpkg.com/@microsoft/[email protected]/dist/office.js
https://unpkg.com/@microsoft/[email protected]/dist/office.d.ts
https://appsforoffice.microsoft.com/lib/1/hosted/office.js
https://appsforoffice.microsoft.com/lib/1/hosted/office.d.ts

[email protected]/dist/css/fabric.min.css
[email protected]/dist/css/fabric.components.min.css
Expand Down
72 changes: 72 additions & 0 deletions samples/outlook/01-body/set-selected-text.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
id: outlook-body-get-set-selected-text
name: Get/Set Selected Text
description: Gets and Changes the value of selected text in body or subject.
endpoints:
- messagecompose
- appointmentcompose
author: OfficeDev
host: OUTLOOK
api_set: {}
script:
content: |
$("#get").click(get);
$("#set").click(set);

function get() {
let item = Office.context.mailbox.item as Office.ItemCompose;
item.getSelectedDataAsync(Office.CoercionType.Text, (result: Office.AsyncResult) => {
if (result.status !== Office.AsyncResultStatus.Succeeded) {
OfficeHelpers.UI.notify(`Action failed with message ${result.error.message}`);
return;
}
$("#text").val(result.value.data)
OfficeHelpers.UI.notify(`Get completed!`);
})
}

function set() {
let item = Office.context.mailbox.item as Office.ItemCompose;
item.setSelectedDataAsync($("#text").val(), (result: Office.AsyncResult) => {
if (result.status !== Office.AsyncResultStatus.Succeeded) {
OfficeHelpers.UI.notify(`Action failed with message ${result.error.message}`);
return;
}
OfficeHelpers.UI.notify(`Set completed!`);
})
}
language: typescript
template:
content: |
<div classs="ms-TextField">
<label class="ms-Label">Selected Data</label>
<input class="ms-TextField-field" type="text" value="" placeholder="Selected Data Goes Here" id="text">
</div>
<br/>
<button id="get" class="ms-Button">
<span class="ms-Button-label">Get</span>
</button>
<button id="set" class="ms-Button">
<span class="ms-Button-label">Set</span>
</button>
language: html
style:
content: |
/* Your style goes here */
language: css
libraries: |
# Office.js
https://appsforoffice.microsoft.com/lib/1/hosted/office.js
https://appsforoffice.microsoft.com/lib/1/hosted/office.d.ts

# CSS Libraries
[email protected]/dist/css/fabric.min.css
[email protected]/dist/css/fabric.components.min.css

# NPM libraries
@microsoft/[email protected]/dist/office.helpers.min.js
[email protected]

# IntelliSense: @types/library or node_modules paths or URL to d.ts files
@types/core-js
@microsoft/[email protected]/dist/office.helpers.d.ts
@types/jquery
44 changes: 0 additions & 44 deletions samples/outlook/01-compose-basics/set-selected-text.yaml

This file was deleted.

Loading