OneNoteConversionTool.OutputGenerator.OneNoteGenerator.CreateNotebook C# (CSharp) Method

CreateNotebook() public method

Creates a new OneNote notebook with the given name
public CreateNotebook ( string notebookName ) : string
notebookName string
return string
		public string CreateNotebook(string notebookName)
		{
			string notebookId;

			try
			{
				_mApp.OpenHierarchy(Path.Combine(_mOutputPath, notebookName), String.Empty, out notebookId, CreateFileType.cftNotebook);
			}
			catch (Exception e)
			{
				throw new ApplicationException("Error in CreateNotebook: " + e.Message, e);
			}

			return notebookId;
		}

Usage Example

		public static void MyClassInitialize(TestContext testContext)
		{
			if (!Directory.Exists(Utility.RootFolder))
			{
				Directory.CreateDirectory(Utility.RootFolder);
			}
			if (!Directory.Exists(Utility.TempFolder))
			{
				Directory.CreateDirectory(Utility.TempFolder);
			}
			_mXmlNs = Utility.NS;
			_mOnGenerator = new OneNoteGenerator(Utility.RootFolder);
			//Get Id of the test notebook so we chould retrieve generated content
			//KindercareFormatConverter will create notebookName as Kindercare
			_mNotebookId = _mOnGenerator.CreateNotebook(NotebookName);

			var word = new Application();
			var doc = word.Application.Documents.Add();

			//add pages to doc
			for (int i = 1; i < DocPageTitles.Count; i++)
			{
				doc.Content.Text += DocPageTitles[i];
				doc.Words.Last.InsertBreak(WdBreakType.wdPageBreak);
			}

			var filePath = TestDocPath as object;
            doc.SaveAs(ref filePath);
            ((_WordDocument)doc).Close();
            ((_WordApplication)word).Quit();
		}
All Usage Examples Of OneNoteConversionTool.OutputGenerator.OneNoteGenerator::CreateNotebook