Compare commits

..

No commits in common. "master" and "0.1.1" have entirely different histories.

8 changed files with 703 additions and 846 deletions

View file

@ -1,5 +1,5 @@
Copyright (C) 2025 David Ingerslev
Copyright (C) 2020-2025 by Dynalist Inc.
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View file

@ -12,14 +12,7 @@ By processing .msg files, the plugin does not depend on having to run code withi
Outlook or on Microsoft 365 administrators authorising an app to connect to the
Microsoft Graph API.
Note about recurring meetings or appointments: Microsoft Outlook does not include
any fields that indicate which of the recurring appointments has been dragged-and-dropped,
so it is not possible to differentiate between them. This means that the start date/time
of the first appointment in the recurring series will be used by default. You may wish
to change the filename template to include the current date/time instead (or as well)
using the helper field [helper_currentDT](#helper_currentDT).
The plugin relies on the wonderful [msgreader](https://github.com/HiraokaHyperTools/msgreader),
It relies on the wonderful [msgreader](https://github.com/HiraokaHyperTools/msgreader),
[mustache.js](https://github.com/janl/mustache.js), and
[mustache-validator](https://github.com/eliasm307/mustache-validator) libraries.
@ -76,8 +69,8 @@ Note - the invalid characters are: `/` `*` `"` `\` `<` `>` `:` `|` `?`
The default template can be customised, or you can write a new
template using mustache syntax (see [the manual](https://mustache.github.io/mustache.5.html)).
All .msg [fields](https://hiraokahypertools.github.io/msgreader/typedoc/interfaces/MsgReader.FieldsData.html)
can be used in a template, and there are also some additional helper fields and
functions you can use to format fields.
can be used in a template, and there are also some additional helper functions you can
use to format fields.
### Default template
The default template for notes is:
@ -96,19 +89,6 @@ meeting-invite: {{body}}
---
```
### Helper fields for templates
There is currently only one helper field available:
#### helper_currentDT
The date and time at which the meeting was dragged-and-dropped onto the icon,
in ISO format (like *2025-04-02T09:31:12+01:00*).
You will probably want to use the [helper_dateFormat](#helper_dateFormat) function
to format it:
```
{{#helper_dateFormat}}{{helper_currentDT}}|YYYY-MM-DD HH.mm.ss{{/helper_dateFormat}}
```
### Helper functions for templates
To use a helper function in a template, include a section for the function, e.g.:
```

24
main.ts
View file

@ -1,8 +1,7 @@
import { App, displayTooltip, Editor, MarkdownView, Notice, Plugin, PluginSettingTab, Setting, TooltipPlacement, EventRef } from 'obsidian';
import { App, displayTooltip, Editor, MarkdownView, Notice, Plugin, PluginSettingTab, Setting, moment, TooltipPlacement, EventRef } from 'obsidian';
import MsgReader from '@kenjiuno/msgreader';
import proxyData from 'mustache-validator';
import Mustache from 'mustache';
import moment from 'moment';
const Mustache = require('mustache');
const OutlookMeetingNotesDefaultFilenamePattern =
'{{#helper_dateFormat}}{{apptStartWhole}}|YYYY-MM-DD HH.mm{{/helper_dateFormat}} {{subject}}';
@ -45,22 +44,18 @@ export default class OutlookMeetingNotes extends Plugin {
const { vault } = this.app;
// Get the file data from MsgReader
const origFileData = msg.getFileData();
const fileData = msg.getFileData();
// Check if we got a suitable meeting
if (origFileData.dataType != 'msg') {
if (fileData.dataType != 'msg') {
throw new TypeError('Outlook Meeting Notes cannot process the file. '
+ 'MsgReader did not parse the file as valid msg format.');
} else if (origFileData.messageClass != 'IPM.Appointment') {
} else if (fileData.messageClass != 'IPM.Appointment') {
throw new TypeError('Outlook Meeting Notes cannot process the file. '
+ 'It is a valid msg file but not an appointment or meeting.');
}
this.addHelperFunctions(origFileData);
// Add helper field for the current date and time
let fileData = origFileData as any;
fileData.helper_currentDT = moment().format();
this.addHelperFunctions(fileData);
let folderPath = this.settings.notesFolder;
if (folderPath == '') { folderPath = '/'; }
@ -80,7 +75,7 @@ export default class OutlookMeetingNotes extends Plugin {
let meetingNoteFile = vault.getFileByPath(filePath);
if (meetingNoteFile) {
// File already exists
new Notice(meetingNoteFile.basename + ' already exists: opening it');
// TODO: send a message to the user
}
else {
if (vault.getFolderByPath(newFolderPath) == null) {
@ -90,7 +85,7 @@ export default class OutlookMeetingNotes extends Plugin {
this.settings.notesTemplate,
fileData);
meetingNoteFile = await vault.create(filePath, mustacheOutput);
new Notice('New file created: ' + meetingNoteFile.basename);
new Notice('New file: ' + meetingNoteFile.basename);
}
const openInNewTab = false;
this.app.workspace.getLeaf(openInNewTab).openFile(meetingNoteFile);
@ -99,7 +94,7 @@ export default class OutlookMeetingNotes extends Plugin {
if (fe) { fe.revealInFolder(meetingNoteFile); }
} catch (ee: unknown) {
// TODO: Handle errors reasonably -- differently between msg missing elements and errors creating file
if (ee instanceof Error) { new Notice('Error (' + ee.name + '):\n' + ee.message); }
if (ee instanceof Error) { new Notice(ee.name + ':\n' + ee.message); }
throw ee;
}
}
@ -118,6 +113,7 @@ export default class OutlookMeetingNotes extends Plugin {
else {
// One file was dropped, hand it over to createMeetingNote
const droppedFile = droppedFiles[0];
new Notice('Dropped: ' + droppedFile.name);
const fr = new FileReader();
fr.onload = () => {

View file

@ -1,10 +1,10 @@
{
"id": "outlook-meeting-notes",
"name": "Outlook Meeting Notes",
"version": "0.2.1",
"minAppVersion": "1.8.9",
"version": "0.1.1",
"minAppVersion": "0.15.0",
"description": "Creates meeting notes for Outlook appointments and meetings.",
"author": "David Ingerslev",
"authorUrl": "https://github.com/davidingerslev",
"isDesktopOnly": false
}
}

1459
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "outlook-meeting-notes",
"version": "0.2.1",
"version": "0.1.1",
"description": "Creates meeting notes for Outlook appointments and meetings.",
"main": "main.js",
"scripts": {
@ -12,16 +12,14 @@
"author": "",
"license": "MIT",
"devDependencies": {
"@types/moment": "^2.11.29",
"@types/mustache": "^4.2.5",
"@types/node": "^22.13.10",
"@typescript-eslint/eslint-plugin": "8.26.1",
"@typescript-eslint/parser": "8.26.1",
"builtin-modules": "5.0.0",
"esbuild": "0.25.1",
"@types/node": "^16.11.6",
"@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0",
"builtin-modules": "3.3.0",
"esbuild": "0.17.3",
"obsidian": "latest",
"tslib": "2.8.1",
"typescript": "5.8.2"
"tslib": "2.4.0",
"typescript": "4.7.4"
},
"dependencies": {
"@kenjiuno/msgreader": "^1.22.0",

View file

@ -8,7 +8,6 @@
"allowJs": true,
"noImplicitAny": true,
"moduleResolution": "node",
"esModuleInterop": true,
"importHelpers": true,
"isolatedModules": true,
"strictNullChecks": true,

View file

@ -1,10 +1,3 @@
{
"0.1.1": "0.15.0",
"0.1.2": "0.15.0",
"0.1.3": "0.15.0",
"0.1.4": "1.8.9",
"0.1.5": "1.8.9",
"0.1.6": "1.8.9",
"0.2.0": "1.8.9",
"0.2.1": "1.8.9"
}
"0.1.1": "0.15.0"
}