예제 #1
0
        public async Task OneNoteGetRecentNotebooks()
        {
            try
            {
                INotebookGetRecentNotebooksCollectionPage recentNotebooksPage = await graphClient.Me
                                                                                .Onenote
                                                                                .Notebooks
                                                                                .GetRecentNotebooks(true)
                                                                                .Request()
                                                                                .GetAsync();

                Assert.True(recentNotebooksPage.Count > 0);
                Assert.NotNull(recentNotebooksPage[0].DisplayName);
            }
            catch (Microsoft.Graph.ServiceException e)
            {
                Assert.True(false, $"Error code: {e.Error.Code}");
            }

            catch (Exception e)
            {
                Assert.True(false, $"Error code: {e.Message}");
            }
        }
예제 #2
0
        public async Async.Task OneNoteGetRecentNotebooks()
        {
            try
            {
                INotebookGetRecentNotebooksCollectionPage recentNotebooksPage = await graphClient.Me
                                                                                .Onenote
                                                                                .Notebooks
                                                                                .GetRecentNotebooks(true)
                                                                                .Request()
                                                                                .GetAsync();

                Assert.IsTrue(recentNotebooksPage.Count > 0, $"Expected at least one recent Notebook; Actual {recentNotebooksPage.Count}");
                Assert.IsNotNull(recentNotebooksPage[0].DisplayName, "Expected an display name; name value is missing.");
            }
            catch (Microsoft.Graph.ServiceException e)
            {
                Assert.Fail("Error code: {0}", e.Error.Code);
            }

            catch (Exception e)
            {
                Assert.Fail("Error code: {0}", e.Message);
            }
        }