Beispiel #1
0
        public async Async.Task OneNotePagePreview()
        {
            try
            {
                // Get a page of OneNote pages
                IOnenoteSectionPagesCollectionPage pageCollection = await graphClient.Me
                                                                    .Onenote
                                                                    .Sections[firstSectionID]
                                                                    .Pages
                                                                    .Request()
                                                                    .GetAsync();

                // Get a handle to the first section.
                string pageId = pageCollection[0].Id;

                // URL to update a page. https://graph.microsoft.com/v1.0/me/onenote/sections/{id}/pages/{id}/preview
                OnenotePagePreview pagePreview = await graphClient.Me
                                                 .Onenote
                                                 .Pages[pageId]
                                                 .Preview()
                                                 .Request()
                                                 .GetAsync();

                Assert.IsNotNull(pagePreview, "OnenotePagePreview object is null. This shouldn't be null. Check your request.");
            }
            catch (Microsoft.Graph.ServiceException e)
            {
                Assert.Fail("Error code: {0}", e.Error.Code);
            }

            catch (Exception e)
            {
                Assert.Fail("Error code: {0}", e.Message);
            }
        }
Beispiel #2
0
        public async Task OneNotePagePreview()
        {
            try
            {
                // Get a page of OneNote pages
                IOnenoteSectionPagesCollectionPage pageCollection = await graphClient.Me
                                                                    .Onenote
                                                                    .Sections[firstSectionID]
                                                                    .Pages
                                                                    .Request()
                                                                    .GetAsync();

                // Get a handle to the first section.
                string pageId = pageCollection[0].Id;

                // URL to update a page. https://graph.microsoft.com/v1.0/me/onenote/sections/{id}/pages/{id}/preview
                OnenotePagePreview pagePreview = await graphClient.Me
                                                 .Onenote
                                                 .Pages[pageId]
                                                 .Preview()
                                                 .Request()
                                                 .GetAsync();

                Assert.NotNull(pagePreview);
            }
            catch (Microsoft.Graph.ServiceException e)
            {
                Assert.True(false, $"Error code: {e.Error.Code}");
            }

            catch (Exception e)
            {
                Assert.True(false, $"Error code: {e.Message}");
            }
        }