From 510f064084f51e14681a1fd4f00a2cdcb52ffa7b Mon Sep 17 00:00:00 2001 From: Heather Heide Date: Wed, 15 Feb 2017 09:59:23 -0800 Subject: [PATCH 1/2] Create Get-Task-GUID.yaml --- samples/project/Get-Task-GUID.yaml | 48 ++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 samples/project/Get-Task-GUID.yaml diff --git a/samples/project/Get-Task-GUID.yaml b/samples/project/Get-Task-GUID.yaml new file mode 100644 index 0000000..00d458f --- /dev/null +++ b/samples/project/Get-Task-GUID.yaml @@ -0,0 +1,48 @@ +id: ciz78veu00000456sgv494kcb +gist: '' +source: PROJECT +author: Microsoft +name: Get Task GUID +description: Get the selected task's GUID. +script: + content: |- + $('#run').click(run); + + function run() { + Office.context.document.getSelectedTaskAsync( + function (asyncResult) { + if (asyncResult.status === Office.AsyncResultStatus.Failed) { + console.log(asyncResult.error.message); + } else { + console.log('Selected task GUID is ' + asyncResult.value); + } + } + ); + } + language: typescript +style: + content: /* Your style goes here */ + language: css +template: + content: |- + + language: html +libraries: |- + // Office.js + https://appsforoffice.microsoft.com/lib/1/hosted/Office.js + + // NPM libraries + jquery + office-ui-fabric-js/dist/js/fabric.min.js + office-ui-fabric-js/dist/css/fabric.min.css + office-ui-fabric-js/dist/css/fabric.components.min.css + @microsoft/office-js-helpers/dist/office.helpers.min.js + core-js/client/core.min.js + + // IntelliSense: Use dt~library_name for DefinitelyTyped or URLs to d.ts files + dt~office-js + dt~jquery + dt~core-js + @microsoft/office-js-helpers/dist/office.helpers.d.ts From ea8a95805a1317b49912e6126b0dd71eabe15c89 Mon Sep 17 00:00:00 2001 From: Heather Heide Date: Wed, 15 Feb 2017 10:01:31 -0800 Subject: [PATCH 2/2] Create Get-Project-Information.yaml --- samples/project/Get-Project-Information.yaml | 80 ++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 samples/project/Get-Project-Information.yaml diff --git a/samples/project/Get-Project-Information.yaml b/samples/project/Get-Project-Information.yaml new file mode 100644 index 0000000..4540b7f --- /dev/null +++ b/samples/project/Get-Project-Information.yaml @@ -0,0 +1,80 @@ +id: ciz79iwgk0000456w9wch1l0m +gist: '' +source: PROJECT +author: Microsoft +name: Get information about the project +description: >- + Shows how to use project level fields to find things like the project's start + date +script: + content: | + + + $('#run').click(getProjectInformation); + + // Get the specified fields for the active project. + function getProjectInformation() { + var fields = + [Office.ProjectProjectFields.Start, Office.ProjectProjectFields.Finish, Office.ProjectProjectFields.GUID]; + var fieldValues = ['Start: ', ' Finish: ', ' GUID: ']; + var index = 0; + getField(); + + // Get each field, and then display the field values in the add-in. + function getField() { + if (index == fields.length) { + var output = ''; + for (var i = 0; i < fieldValues.length; i++) { + output += fieldValues[i]; + } + console.log(output); + } + else { + Office.context.document.getProjectFieldAsync( + fields[index], + function (result) { + + // If the call is successful, get the field value and then get the next field. + if (result.status === Office.AsyncResultStatus.Succeeded) { + fieldValues[index] += result.value.fieldValue; + getField(index++); + } + else { + onError(result.error); + } + } + ); + } + } + } + + function onError(error) { + console.log(error); + } + language: typescript +style: + content: /* Your style goes here */ + language: css +template: + content: |- + + language: html +libraries: |- + // Office.js + https://appsforoffice.microsoft.com/lib/1/hosted/Office.js + + // NPM libraries + jquery + office-ui-fabric-js/dist/js/fabric.min.js + office-ui-fabric-js/dist/css/fabric.min.css + office-ui-fabric-js/dist/css/fabric.components.min.css + @microsoft/office-js-helpers/dist/office.helpers.min.js + core-js/client/core.min.js + + // IntelliSense: Use dt~library_name for DefinitelyTyped or URLs to d.ts files + dt~office-js + dt~jquery + dt~core-js + @microsoft/office-js-helpers/dist/office.helpers.d.ts