该工具借助Node.js实现与OneNote的交互操作,可对OneNote的笔记本、章节和页面进行读取、写入和搜索等操作,为用户提供便捷的笔记管理体验。
若要使用本工具,可按以下步骤进行安装和启动:
git clone https://github.com/yourusername/onenote-node.git
cd onenote-node
npm install
npm start
git clone https://github.com/yourusername/onenote-node.git
cd onenote-node
npm install
npm start
const { OneNoteClient } = require('onenote-node');
const client = new OneNoteClient();
async function listNotebooks() {
const notebooks = await client.listNotebooks();
console.log(notebooks);
}
listNotebooks(); // 输出所有OneNote笔记本信息
async function createPage(notebookId, sectionId) {
const pageContent = `# 新页面标题\n## 内容`;
await client.createPage(notebookId, sectionId, pageContent);
console.log("页面创建成功");
}
// 获取所有笔记文件夹
client.listNotebooks().then(notebooks => {
console.log("检测到以下笔记本:", notebooks);
});
// 读取指定页面内容
client.getPage(notebookId, sectionId, pageId).then(pageContent => {
console.log("页面内容:", pageContent);
});
// 创建新章节
const newSectionName = "任务清单";
client.createSection(notebookId, newSectionName);
// 更新页面内容
const newPageContent = `# 今日任务\n1. 完成项目报告\n2. 参加会议`;
client.updatePage(pageId, newPageContent);
| 工具名称 | 描述 |
|---|---|
| listNotebooks | 获取所有OneNote笔记本 |
| getNotebook | 获取指定笔记本详细信息 |
| listSections | 列出笔记本中的章节 |
| listPages | 显示章节内的页面 |
| getPage | 获取特定页面的完整内容 |
| createPage | 创建带有HTML格式的新页面 |
项目根目录下包含配置文件config.json,用于存储API连接信息。请根据实际情况进行修改。
本项目遵循MIT许可证,具体条款见LICENSE文件。
更多详细内容请参考项目文档或直接运行示例脚本体验功能。