Share via

Select several objects in OneNote programmatically

Anonymous
2012-08-30T12:32:33+00:00

Hi all!

Is there any way to select several objects in OneNote programmatically? Can I, for example, via Win32 API or MSAA/UIAutomation select several objects in current OneNote window? (each object is a table cell with its own objectID)

In my case - the section is in read only mode (the section file marked with attribute "read only"). So I can not update the page xml.

I need to raise mouse event in the area of object (table cell), for example. Or something else. For this I need to get the object coordinates.

For example if I create an OneNote link from one page to another page object - the link will be looks like "onenote://J:/....". We can find the "onenote:" protocol handler in regedit. The handler is "C:\Program Files\Microsoft Office 15\Root\Office15\ONENOTE.EXE" /hyperlink "%1".

So If I run onenote.exe with parameter "/hyperlink [the link]" - OneNote will open the page and the object will be selected!

So I want something like this but for several objects. For example to call method of OneNote.exe or DLL library to select page objects.

Thanks.

Microsoft 365 and Office | OneNote | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

7 answers

Sort by: Most helpful
  1. Anonymous
    2012-09-01T08:32:56+00:00

    Nothing. Only select objects.

    Let me explain:

    This question is related to http://answers.microsoft.com/en-us/office/forum/office_2010-onenote/create-a-link-to-several-paragraphs-in-onenote/e7a4124d-6db8-4d47-afb5-5ccea3e08968

    This opportunity is very useful for my open source project: http://IStudyBibleTools.com - the Program for independent Bible study.

    There is a Bible chapter (the table on OneNote page). Each verse of chapter - is a table cell.

    User writes notes while studying the Bible. The program analyzes the user's notes, extracts the Bible references (for example "Genesis 5:6-9") and makes the links from these Bible references. So now when user clicks this link - the OneNote page with this verses will open. But now only first verse will be selected.

    What I want to do:

    1. Register the Custom Protocol

    1. Register the Application Handling the Custom Protocol (http://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx)
    2. Create links like: "isbtlink://pageId=[chapter page id];objectsIds=[verses cells objects ids]"
    3. When user clicks this link - custom application will handle this click, get the page id and the objects ids, call IApplication.NavigateTo() method and select all verses objects on the opened page.

    The problem is that the Bible Notebook is locked. So I need to accomplish this without page xml updating. I think Win32 API or MSAA/UIAutomation - is the right way (here is the example - http://msaaverify.codeplex.com/).

    But what methods should I use? First, I need to find the cell object by ObjectId, second, I need to select this object.

    Thanks.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2012-08-31T20:15:44+00:00

    What is your end goal? What will you do once you get the objects selected on a read-only section?

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2012-08-31T06:03:00+00:00

    There isn't a supported way to do this via .NET managed code. But what about Win32 API or MSAA/UIAutomation? And I agree on unsupported way :)

    May be there is an opportunity to unlock the section, update the page xml, lock the section - and the message "This section contains changes that cannot be synced because access to the section file is denied" was not shown?

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2012-08-31T03:07:21+00:00

    There isn't a supported way to do this for read-only sections. For writable sections you can use UpdatePageContent api to change selection.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2012-08-31T02:35:42+00:00

    You may also post your question in Microsoft Office for Developer forum mentioned below for better suggestion:

    http://social.msdn.microsoft.com/Forums/en-US/category/officedev,oldevelopment,sharepoint2010,sharepoint,projectserver2010,projectprofessional2010,uc/

    Was this answer helpful?

    0 comments No comments