This project is read-only.

Finding and manipulating flagged items

Apr 14, 2008 at 2:54 PM
I am trying to figure out how to search for all items across all notebooks that have a specific flag ("open"). I want to be able to get the items and later I want to update the type of flag ("closed"). I need to do this in the .NET 2.0 version. Any pointers?
Apr 16, 2008 at 8:05 PM
Edited Apr 16, 2008 at 8:07 PM
What exactly do you mean by a flag? An outlook task or a Tag? I don't think the ONOM supports them yet, so you'll have to get your hands dirty with the XML from the page.

You can look at the page XML . For an outlook task it is something like

<one:OE creationTime="2008-04-16T18:59:48.000Z" lastModifiedTime="2008-04-16T18:59:48.000Z" objectID="{6575C543-594E-4863-940C-5FB55B7EB3D8}{70}{B0}" alignment="left">
<one:OutlookTask startDate="2008-04-18T00:00:00.000Z" dueDate="2008-04-18T00:00:00.000Z" guidTask="{B2667F23-3481-49B0-9C90-6D959D6CCCAC}" completed="false" disabled="false" creationDate="2008-04-16T18:59:44.000Z" />

So I assume changing the completed to true, and pushing it back into OneNote should do what you want it to do. However it is going to be really slow if you have to get the XML from each page.
Apr 16, 2008 at 10:13 PM
Yes, I meant Tagged. The problem is speed. My understanding is that when OneNote searches tags it is an indexed search. exporting all to XML and then searching would be slow as you said.
Apr 19, 2008 at 5:12 AM

As far as I know, the API doesn't expose a search method for Tags, only findPages. Searching for tags has a separate search box, so I don't thin you can search for tags through the FindPages API. If you could figure out a way to search for pages containing the the tag you want through the standard search box then you could use the FindPages call to do what you want.

The only way around I can think of is create some sort of indexing service on your own. Let me know if you can figure something out - I am also looking for a way to search all pages for embedded files. An idea I had was to maintain my own separate XML file; and updating it by comparing the lastModifiedTime on the pages. that way I need to build my XML once, and then only update for the pages which are changed. Still not as fast as the indexing service - but still better than parsing all the files. The API is unfortunately a little limited :(.