none
How to programmatically copy a OneNote page to clipboard RRS feed

  • Question

  • Hello,

    I have a problem when developing an Outlook add-in. My situation is as follows:

    I want to copy the content of a OneNote page to Outlook Mailitem (knowing OneNote pageID). Recently, by using Outlook.Inspector.WordEditor, I can get data from clipboard and display it in Outlook mailitem. But I don't know how to programmatically copy the content of a OneNote page to clipboard. I don't find any interface in OneNote 2010 Developer Reference which support me to do so.

    Actually, OneNote already has the function I want. One can copy a page by right-clicking a page title and clicking 'copy'. But How does this function be implemented?

    Or, is there a better way to move formatted content from OneNote to Outlook? I have tried HtmlBody, but HtmlBody cannot insert from cursor position.

    Thanks.

     

    Wednesday, December 14, 2011 4:29 AM

Answers

  • Hello Ross,

    The OneNote 2010 object model doesn’t have a “Copy” method for a page. But it does provide for publishing to a number of  formats.

     

    There is a reference to the published content for OneNote at the “OneNote Developer Center”
    Microsoft OneNote Developer Center | References, Articles | MSDN
    http://msdn.microsoft.com/en-us/office/aa905452

    Where you’ll see links to “Outputting OneNote Page Content from VBA Sources,” and
    “Outputting OneNote Page Content to PDF files

    The VBA code in the first can be translated to VB ,NET or C#.

    The approach is similar to ‘Publishing’ the page to .MHTML (.mht)’ using the Publish method

    Publish Method

    The Publish method exports the page you specify to a file in any format that OneNote supports. Currently, the following file formats are supported:

    ·         MHTML files (.mht)

    ·         Adobe Acrobat PDF files (.pdf)

    ·         XML Paper Specification (XPS) files (.xps)

    ·         OneNote files (.one)

    ·         OneNote Archive files (.onea)

    ·         Microsoft Office Word documents (.doc or .docx)

    ·         Microsoft Windows Enhanced Metafiles (.emf)

    This method produces exactly the same results you would get by clicking Publish in the UI and specifying the format

    Please “Mark as answer” if my reply helps  you.

    Regards,
    Chris Jensen
    Senior Technical Support Lead

    • Edited by cjatmsModerator Thursday, December 15, 2011 5:06 PM
    • Proposed as answer by cjatmsModerator Monday, December 19, 2011 4:15 PM
    • Marked as answer by Bruce Song Monday, December 26, 2011 6:22 AM
    Thursday, December 15, 2011 5:06 PM
    Moderator

All replies

  • Hi Ross,

    I will help you involve others to help you. There might be some delay about the response. Appreciate your patience.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Thursday, December 15, 2011 9:00 AM
  • Hello Ross,

    The OneNote 2010 object model doesn’t have a “Copy” method for a page. But it does provide for publishing to a number of  formats.

     

    There is a reference to the published content for OneNote at the “OneNote Developer Center”
    Microsoft OneNote Developer Center | References, Articles | MSDN
    http://msdn.microsoft.com/en-us/office/aa905452

    Where you’ll see links to “Outputting OneNote Page Content from VBA Sources,” and
    “Outputting OneNote Page Content to PDF files

    The VBA code in the first can be translated to VB ,NET or C#.

    The approach is similar to ‘Publishing’ the page to .MHTML (.mht)’ using the Publish method

    Publish Method

    The Publish method exports the page you specify to a file in any format that OneNote supports. Currently, the following file formats are supported:

    ·         MHTML files (.mht)

    ·         Adobe Acrobat PDF files (.pdf)

    ·         XML Paper Specification (XPS) files (.xps)

    ·         OneNote files (.one)

    ·         OneNote Archive files (.onea)

    ·         Microsoft Office Word documents (.doc or .docx)

    ·         Microsoft Windows Enhanced Metafiles (.emf)

    This method produces exactly the same results you would get by clicking Publish in the UI and specifying the format

    Please “Mark as answer” if my reply helps  you.

    Regards,
    Chris Jensen
    Senior Technical Support Lead

    • Edited by cjatmsModerator Thursday, December 15, 2011 5:06 PM
    • Proposed as answer by cjatmsModerator Monday, December 19, 2011 4:15 PM
    • Marked as answer by Bruce Song Monday, December 26, 2011 6:22 AM
    Thursday, December 15, 2011 5:06 PM
    Moderator