public async Task<Notebook> GetNotebookPages(Notebook notebook, string sectionid) { // ensure connection established to new onenote API if ((string.IsNullOrEmpty(_oneNoteEndpoint)) || (string.IsNullOrEmpty(_oneNoteResourceId))) { await InitOneNoteRestConnection(); } HttpRequestMessage request = null; HttpResponseMessage response = null; string responseString; // for the specified section... var section = notebook.Sections.First(s => s.Id == sectionid); // get all the pages in the section request = new HttpRequestMessage(HttpMethod.Get, section.PagesUrl); response = await _client.SendAsync(request); // convert to JSON object responseString = await response.Content.ReadAsStringAsync(); var jsonPages = JsonConvert.DeserializeObject<JsonHelpers.PagesJson>(responseString); // loop through all pages foreach (var jsonPage in jsonPages.Pages) { // convert pages to model objects var page = new NotePage { Id = jsonPage.Id, Name = jsonPage.Title, CreatedDateTime = jsonPage.CreatedTime, LastModifiedDateTime = jsonPage.LastModifiedTime, PageUrl = jsonPage.PageUrl, ClientUrl = jsonPage.Links.OneNoteClientUrl.href, WebUrl = jsonPage.Links.OneNoteWebUrl.href, ContentUrl = jsonPage.ContentUrl }; // get the body of the page request = new HttpRequestMessage(HttpMethod.Get, page.ContentUrl); response = await _client.SendAsync(request); page.Content = await response.Content.ReadAsStringAsync(); // add page to section section.Pages.Add(page); } return notebook; }