Skip to content

Commit f4abe94

Browse files
committed
Add ability to create quick note
1 parent e91dd67 commit f4abe94

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Main.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ public List<Result> Query(Query query)
7575
return false;
7676
},
7777
});
78+
results.Add(new Result
79+
{
80+
Title = "New quick note",
81+
Score = -4000,
82+
IcoPath = Icons.NewPage,
83+
Action = c =>
84+
{
85+
ScipBeExtensions.CreateAndOpenPage();
86+
return true;
87+
}
88+
});
89+
7890
results.Add(new Result
7991
{
8092
Title = "Open and sync notebooks",

ScipBeExtensions.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,17 @@ public static void CreateAndOpenPage(IOneNoteSection section, string pageTitle)
9292

9393
onenote.SyncHierarchy(pageID);
9494
onenote.NavigateTo(pageID);
95+
public static void CreateAndOpenPage()
96+
{
97+
CallOneNoteSafely(oneNote =>
98+
{
99+
oneNote.GetSpecialLocation(SpecialLocation.slUnfiledNotesSection, out string path);
100+
oneNote.OpenHierarchy(path, null, out string sectionID, CreateFileType.cftNone);
101+
102+
oneNote.CreateNewPage(sectionID, out string pageID, NewPageStyle.npsDefault);
103+
104+
oneNote.SyncHierarchy(pageID);
105+
oneNote.NavigateTo(pageID);
95106
});
96107
}
97108

0 commit comments

Comments
 (0)