How to insert pdf as printout programatically to onenote 2010. RRS feed

  • Question

  • I already have an addin developed which creates a new page in onenote. My addin runs inside outlook and when new mail arrives it generates the page in onenote and adds an outline. All I need now is the xml example for inserting a file as printout.
    • Moved by David Wolters Thursday, January 26, 2012 3:37 PM moving to a more appropriate forum (From:Office IT Pro General Discussions)
    Thursday, January 26, 2012 2:04 PM

All replies

  • Hi,

    Thank you for posting.

    As far as I know, outlook object model contains a method PrintOut which can output the the mail to the OneNote:

    Sub printmsg()
    Dim mailI As mailItem
    Set mailI = Application.ActiveInspector.CurrentItem
    End Sub

    I am not sure whether this is want you wanted, because this need to select the printer and choose the section in onenote page beforehand. Then, the message will be exported as png onto the onenote page.

    Please let me know if this help you.

    Best Regards,

    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    • Edited by Bruce Song Friday, January 27, 2012 7:35 AM
    Friday, January 27, 2012 7:30 AM
  • Thank your for your response, but I am currently manipulating the onenote pages using the UpdatePageContent method of the onenote api. Also, this is designed to run as a service application where there is no user interaction when the mail arrives.


    Since the last post, I have been able to get the body of the email successfully into the page using this method via the mail.HTMLBody property of the outlook mail object. This is sufficient for the mail body. I would however, still like to know if there is documentation or examples of xml's that will perform inserts of images/files into one note pages as the api document describes but doesn't demonstrate. At this point, even if the file is inserted not as print out, but rather a copy of the document like an attachment on the page, that would be ok.


    MSXML2.IXMLDOMElement newElement;
    MSXML2.IXMLDOMNode newNode;

    //' Create Outline node.
    newElement = doc.createElement("one:Outline");
    newNode = pageNode.appendChild(newElement);

    //' Create OEChildren.
    newElement = doc.createElement("one:OEChildren");
    newNode = newNode.appendChild(newElement);

    //create HTMLBlock
    newElement = doc.createElement("one:HTMLBlock");
    newNode = newNode.appendChild(newElement);

    //create Data Element
    newElement = doc.createElement("one:Data");
    newNode = newNode.appendChild(newElement);

    //' Add the text for the Page's content.
    cd = doc.createCDATASection(mail.HTMLBody);
    //newNode.appendChild cd
    newNode.appendChild (cd);

    //' Update OneNote with the new content.


    Friday, January 27, 2012 9:46 PM