none
Adding MetaData to OneNote NoteBook RRS feed

  • Question

  • Hi

    In Word you can add and see custom user fields about the document.

    In my case i want to add some metadata to OneNote (assume 2010)

    I can found articles on programmatically reading the data (good) and writing the data.

    => Does a convient plugin exist to add some data ?

    or is it just possible to edit the XML directly ? (i assume that is how the data is stored under the bonnet)

    Thanks

    Sunday, February 10, 2013 4:35 AM

Answers

  • MeadaData is only supported in OneNote pages.  You can use following function to add metadata to a page

            private static void AddPageMetaData(string pageId, string pageMetaID, string pageMetaData)
            {
                Microsoft.Office.Interop.OneNote.Application m_app = new Microsoft.Office.Interop.OneNote.Application();
                string strPagContent = 
                          "<one:Page xmlns:one=\"http://schemas.microsoft.com/office/onenote/2010/onenote\" ID=\"{0}\" >" +
                          "<one:Meta name=\"{1}\" content=\"{2}\"/>" + 
                          "</one:Page>";
                strPagContent = string.Format(strPagContent, pageId, pageMetaID, pageMetaData);
                m_app.UpdatePageContent(strPagContent);
            }

    • Marked as answer by Greg B Roberts Tuesday, February 12, 2013 12:05 AM
    Monday, February 11, 2013 8:42 AM

All replies

  • Hi Greg,

    Thanks for posting in the MSDN Forum.

    I will involve some experts into this issue to see whether they can help you out. There might be some time delay, appreciate for your patience.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, February 11, 2013 2:04 AM
    Moderator
  • MeadaData is only supported in OneNote pages.  You can use following function to add metadata to a page

            private static void AddPageMetaData(string pageId, string pageMetaID, string pageMetaData)
            {
                Microsoft.Office.Interop.OneNote.Application m_app = new Microsoft.Office.Interop.OneNote.Application();
                string strPagContent = 
                          "<one:Page xmlns:one=\"http://schemas.microsoft.com/office/onenote/2010/onenote\" ID=\"{0}\" >" +
                          "<one:Meta name=\"{1}\" content=\"{2}\"/>" + 
                          "</one:Page>";
                strPagContent = string.Format(strPagContent, pageId, pageMetaID, pageMetaData);
                m_app.UpdatePageContent(strPagContent);
            }

    • Marked as answer by Greg B Roberts Tuesday, February 12, 2013 12:05 AM
    Monday, February 11, 2013 8:42 AM
  • Thanks

    Disappointing that there is not metadata on the book itself, however there no reason why a standard section / page can't exist, e.g. like a document index with this info in it.

    Regards Greg

    Tuesday, February 12, 2013 12:06 AM