public void GetAllNotebooks() { var factory = new GraphNotebookFactory(); var list = factory.GetAllItems(); Assert.IsNotNull(list); Assert.IsTrue(list.Count > 0); }
public void GetNotebook() { var id = "0-3AE547978144BF51!117"; var factory = new GraphNotebookFactory(); var notebook = factory.GetItem(id); Assert.IsNotNull(notebook); Assert.IsTrue(notebook.Id.Equals(id)); }
public void CreateNotebook() { var notebookInst = new Notebook { DisplayName = "New Notebook", }; var factory = new GraphNotebookFactory(); var notebook = factory.AddItem(notebookInst); Assert.IsNotNull(notebook.Id); Assert.IsTrue(notebook.DisplayName.Equals(notebookInst.DisplayName)); }
/// <summary> /// Creates OneNote notebook /// </summary> /// <returns></returns> private static Notebook OpenOrCreateNotebook() { // get notebooks Console.WriteLine("loading notebooks ..."); var notebookFactory = new GraphNotebookFactory(); List <Notebook> notebooks = notebookFactory.GetAllItems(); var notebook = notebooks.FirstOrDefault(n => n.DisplayName == "Sample Notebook"); // no notebooks, creating new one if (notebook == null) { notebook = notebookFactory.AddItem(new Notebook { DisplayName = "Sample Notebook" }); Console.WriteLine($"Created notebook: {notebook.DisplayName}"); } return(notebook); }