如何在OneNote中以编程方式创建链接的注释? [英] How To Programatically Create Linked Notes in OneNote?
问题描述
我正在为OneNote添加一个加载项,以帮助我自动化我的一些任务组织。我正在将笔记本的一部分复制到我的笔记本的另一部分,这是95%的部分,但是我无法弄清楚的一件就是创建LinkedNotes。
我相信我的架构是正确的:
< one:LinkedNote state =" 0">
< one:LinkedNoteUri><![CDATA [notelink:// blahblahblah]]>< / one:LinkedNoteUri>
&NBSP;&NBSP; < one:LinkedNoteShortName><![CDATA [我的链接!]]>< / one:LinkedNoteShortName>
&NBSP; < one:LinkedNoteFriendlyName><![CDATA [My Link!]]>< / one:LinkedNoteFriendlyName>
< / one:LinkedNote>
I'm working on an add-in for OneNote to help me automate some of my task organization. I'm copying items from one part of my notebook to another section of my notebook and it's 95% of the way there, but the one piece I can't figure out is creating LinkedNotes.
I believe my schema is correct:
<one:LinkedNote state="0">
<one:LinkedNoteUri><![CDATA[notelink://blahblahblah]]></one:LinkedNoteUri>
<one:LinkedNoteShortName><![CDATA[My Link!]]></one:LinkedNoteShortName>
<one:LinkedNoteFriendlyName><![CDATA[My Link!]]></one:LinkedNoteFriendlyName>
</one:LinkedNote>
我认为问题是实际的Uri。当查看现有的链接时,URI看起来像这样:
I believe the problem is the actual Uri. When looking at existing linkednotes the URI looks liked this:
notelink:// FBF634D2-884D-4BEA-88C1-174E5187AF0D / onenote%3ATime%26section-id%3D%7B02FE7AAF-7BC9- 4F97-A7B2-B46ECEBB2BBA%7D%26page-id%3D%7B8857B2AA-4D63-4A8F-84C9-70A07D0F75EB%7D%26object-id%3D%7BDB6EF273-8B33-09B3-127A-7339FE620CE6%7D%26
notelink://FBF634D2-884D-4BEA-88C1-174E5187AF0D/onenote%3ATime%26section-id%3D%7B02FE7AAF-7BC9-4F97-A7B2-B46ECEBB2BBA%7D%26page-id%3D%7B8857B2AA-4D63-4A8F-84C9-70A07D0F75EB%7D%26object-id%3D%7BDB6EF273-8B33-09B3-127A-7339FE620CE6%7D%26
或Url解码:
notelink:// FBF634D2-884D-4BEA-88C1-174E5187AF0D / onenote:Time& section-id = {02FE7AAF-7BC9-4F97- A7B2-B46ECEBB2BBA}& page-id = {8857B2AA-4D63-4A8F-84C9-70A07D0F75EB}& object-id = {DB6EF273-8B33-09B3-127A-7339FE620CE6}&
notelink://FBF634D2-884D-4BEA-88C1-174E5187AF0D/onenote:Time§ion-id={02FE7AAF-7BC9-4F97-A7B2-B46ECEBB2BBA}&page-id={8857B2AA-4D63-4A8F-84C9-70A07D0F75EB}&object-id={DB6EF273-8B33-09B3-127A-7339FE620CE6}&
我认为,问题在于我从层次结构中获得的ID。示例:
The problem, I believe, is the IDs I get from the hierarchy. Example:
NotebookID:{C9D7064B-3BE9-4B47-ADAE-831DAAAD4334} {1} {B0}
SectionID:{5A643683-78AF-00B9-2CF8 -5870571CB377} {1} {B0}
PageID:{5A643683-78AF-00B9-2CF8-5870571CB377} {1} {E1947155439090587235891923370519797889716581}
ObjectID:{57751C52-B7D1 -4812-B6E8-C601602D0BC0} {101} {B0}
当我尝试使用模式中的那些时:
notelink:/ / MyNotebookID / onenote:PageName& section-id = MySectionID& page-id = MyPageID& object-id = MyObjectID&
失败。有没有人知道是否有可能获得用于形成linkedNotes的guid?
NotebookID: {C9D7064B-3BE9-4B47-ADAE-831DAAAD4334}{1}{B0}
SectionID: {5A643683-78AF-00B9-2CF8-5870571CB377}{1}{B0}
PageID: {5A643683-78AF-00B9-2CF8-5870571CB377}{1}{E1947155439090587235891923370519797889716581}
ObjectID: {57751C52-B7D1-4812-B6E8-C601602D0BC0}{101}{B0}
When I attempt to use those in the pattern:
notelink://MyNotebookID/onenote:PageName§ion-id=MySectionID&page-id=MyPageID&object-id=MyObjectID&
It fails. Does anyone know if its possible to get the guids that are used to form the linkedNotes?
推荐答案
好的,我找到了一个解决方案,但是仍然有问题。这是一种解决方法,但如果我调用GetHyperlinkToObject,我会得到类似
Okay, I found a solution, but still have questions. It's kind of a work around but if I call GetHyperlinkToObject I get a string something like
的字符串onenote:// https://some.really.longpath/mynotebook。一次性&安培;节-ID = {02FE7AAF-7BC9-4F97-A7B2-B46ECEBB2BBA}&安培;页-ID = {8857B2AA-4D63-4A8F-84C9-70A07D0F75EB}&安培;对象ID = {DB6EF273-8B33-09B3-127A-7339FE620CE6 }&
onenote://https://some.really.longpath/mynotebook.oneTime§ion-id={02FE7AAF-7BC9-4F97-A7B2-B46ECEBB2BBA}&page-id={8857B2AA-4D63-4A8F-84C9-70A07D0F75EB}&object-id={DB6EF273-8B33-09B3-127A-7339FE620CE6}&
正如您将注意到,最后一部分的格式与Linkednote在其URI中所期望的格式相同。我发现的一件事是,当您保存URI时,URI必须是URLEncoded。它几乎必须看起来与我上面发布的编码版本完全一样。
As you'll notice the last part is the same format as what linkednote expects in its URI. One thing I discovered is that the URI must be URLEncoded when you save it. It pretty much has to look exactly like the encoded version I posted above.
有些事我还有疑问:
1. The URI以notelink开头:// FBF634D2-884D-4BEA-88C1-174E5187AF0D / onenote ...
$
我假设GUID是notebookID,但我不确定。现在我正在使用硬编码值。有谁知道这个GUID来自哪里?
1. The URI starts with notelink://FBF634D2-884D-4BEA-88C1-174E5187AF0D/onenote...
I assumed the GUID was the notebookID, but I'm not certain of that. For now I'm using a hardcoded value. Does anyone know for sure where this GUID comes from?
2。幸运的是,我发现超链接生成相同的GUID,但是解析超链接并将onenote链接拼接在一起似乎有点粗略/易于破解。有没有人知道获得Section,Page和Object GUID的更一致的方法?
2. Luckily I discovered that the hyperlink generates the same GUIDs, but parsing the hyperlink and stitching together a onenote link seems kind of sketchy/easy to break. Does anyone know of a more consistent way of getting the Section, Page, and Object GUIDs?
这篇关于如何在OneNote中以编程方式创建链接的注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!