none
OneNote API - Publishing as OneNote package RRS feed

  • Question

  • Hello.

    I write add-in for OneNote 2010 using this instruction http://www.malteahrens.com/#/blog/howto-onenote-dev/ . I am developing in Visual Studio 2010.

    I need to publish current opened OneNote notebook to .onepkg format. I do it using next code:

    string filename = "d:\\test.onepkg"; File.Delete(filename); onApp.Publish(onApp.Windows.CurrentWindow.CurrentNotebookId,

    filename,

    PublishFormat.pfOneNotePackage); System.Threading.Thread.Sleep(1000); MessageBox.Show(File.Exists(filename).ToString());

    If I execute code, MessageBox gives "false". But when this ribbon button code finished I will see created .onepkg file on disk.

    If I execute next code, but converted to pdf MessageBox shows "true".

    I need .onepkg file inside method to send it to server.

    Is it OneNote bug or I am doing something wrong? What can be solution of this problem?

    Thank you for any answers.

    Regards, Vladimir. 

    Monday, February 25, 2013 11:00 AM

Answers

  • Hello Vladimir,

    The issue is occurring because the Publish method is being executed asynchronously. However, the publish starts after the event is completed. Hence, you are getting False when you check for file existance. In case of PDF, the execution completes faster.

    It would require a paid support to check why this behavior occurs with package files as requires in-depth analysis. Please visit the below link to see the various paid support options that are available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    Thanks,

    Sreerenj G Nair

    Friday, March 1, 2013 2:02 AM

All replies

  • Hi Vladimior,

    Thank you for posting in the MSDN Forum.

    I'll consult your issue with my colleague. You'll be informed if there's any update.

    Thank you for your patience and understanding.

    Best regards,


    Quist Zhang [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.

    Tuesday, February 26, 2013 11:54 AM
    Moderator
  • Hello Vladimir,

    The issue is occurring because the Publish method is being executed asynchronously. However, the publish starts after the event is completed. Hence, you are getting False when you check for file existance. In case of PDF, the execution completes faster.

    It would require a paid support to check why this behavior occurs with package files as requires in-depth analysis. Please visit the below link to see the various paid support options that are available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    Thanks,

    Sreerenj G Nair

    Friday, March 1, 2013 2:02 AM
  • Thank for your answer, Sreerenj Na.

    How can I know that publishing finished? Does exist any event (for example, OnPublishFinished) for this purposes?

    Regards, Vladimir

    Friday, March 1, 2013 8:55 AM