office-addins - 从 Onenote 页面检索和更新 NoteTag
问题描述
我为 Onenote 创建了一个 Office 加载项,我正在尝试检索和更新页面上的 NoteTags 属性。
该图显示了带有 4 个 ToDo 标签的 Onenote 页面。它还显示了由以下代码生成的控制台日志。在控制台中,我可以看到来自 ToDo 标签的段落 ID、类型和文本。
我需要在代码中更改哪些内容以检索 NoteTag 的“Id”、“Status”和“Type”,以及如何清除已检查的 ToDo 标签?
function getParagraph() {
OneNote.run(function (context) {
// Get the collection of pageContent items from the page.
var pageContents = context.application.getActivePage().contents;
// Get the first PageContent on the page, and then get its Outline's first paragraph.
var pageContent = pageContents.getItemAt(0);
var paragraphs = pageContent.outline.paragraphs;
paragraphs.load("id, type, richText");
// Run the queued commands, and return a promise to indicate task completion.
return context.sync()
.then(function () {
// Display the properties.
$.each(paragraphs.items, function(index, paragraph) {
// Write text from paragraph to console
console.log(
"Paragraph Id: " + paragraph.id +
"; Type: " + paragraph.type +
"; Text: " + paragraph.richText.text);
});
});
})
.catch(function(error) {
onError(error);
});
}
解决方案
推荐阅读
- python - 运行python脚本时出错:“AttributeError:'EventObject'对象没有属性'sentence'”
- database - 弹性搜索作为持久数据库
- magento - Magento 2 default currency based on country
- excel - 将不相邻的数据点添加到图表
- c# - 为要在 foreach 中使用的 ITuple 类型对象实现 GetEnumerator
- windows - 如果不小心直接更改为驱动器,如何更改 Windows 10 屏幕截图目标文件夹?
- feathersjs - FeathersJs - 清理用户服务中 Find 方法的响应破坏了身份验证服务
- javascript - 如何从 discord.js 中的 JSON 对象中检索消息作为对象?
- sharepoint-online - 更新列表和库控件中的总计
- ruby-on-rails - Puma 和 byebug/pry 在并发请求期间导致终端损坏