Exemple #1
0
        public async Async.Task SharePointGetDocumentLibraries()
        {
            try
            {
                // Specify the search query parameter.
                var searchQuery = new QueryOption("search", "Office 365 Demos");
                var options     = new List <QueryOption>();
                options.Add(searchQuery);

                // Call the Microsoft Graph API. Expecting a single search entry from the tenant.
                var siteSearchResults = await graphClient.Sites.Request(options).GetAsync();

                Assert.IsTrue(siteSearchResults.Count > 0, "Expected at least one search result. Got zero. Check test data.");

                // Call the Microsoft Graph API. Get the drives collection page.
                SiteDrivesCollectionPage drives = (SiteDrivesCollectionPage)graphClient.Sites[siteSearchResults[0].Id].Drives.Request().GetAsync().Result;


                Assert.IsTrue(drives.Count > 0, "Expected at least one drive result. Got zero. Check test data.");
            }
            catch (Microsoft.Graph.ServiceException e)
            {
                Assert.Fail("Something happened, check out a trace. Error code: {0}", e.Error.Code);
            }
        }
Exemple #2
0
        public async Task It_gets_the_sites_drives()
        {
            try
            {
                // Specify the search query parameter.
                var searchQuery = new QueryOption("search", "Office 365 Demos");
                var options     = new List <QueryOption>();
                options.Add(searchQuery);

                // Call the Microsoft Graph API. Expecting a single search entry from the tenant.
                var siteSearchResults = await graphClient.Sites.Request(options).GetAsync();

                Assert.True(siteSearchResults.Count > 0);

                // Call the Microsoft Graph API. Get the drives collection page.
                SiteDrivesCollectionPage drives = (SiteDrivesCollectionPage)graphClient.Sites[siteSearchResults[0].Id].Drives.Request().GetAsync().Result;


                Assert.True(drives.Count > 0);
            }
            catch (Microsoft.Graph.ServiceException e)
            {
                Assert.False(true, $"Something happened, check out a trace. Error code: {e.Error.Code}");
            }
        }
Exemple #3
0
        public async Async.Task It_gets_the_sites_drives_root_children()
        {
            try
            {
                // Specify the search query parameter.
                var searchQuery = new QueryOption("search", "sales");
                var options     = new List <QueryOption>();
                options.Add(searchQuery);

                // Call the Microsoft Graph API. Expecting a single search entry from the tenant.
                var siteSearchResults = await graphClient.Sites.Request(options).GetAsync();

                Assert.True(siteSearchResults.Count > 0, "Expected at least one search result. Got zero. Check test data.");

                // Call the Microsoft Graph API. Get the sites drives collection page.
                SiteDrivesCollectionPage drives = (SiteDrivesCollectionPage)graphClient.Sites[siteSearchResults[0].Id]
                                                  .Drives
                                                  .Request()
                                                  .GetAsync()
                                                  .Result;

                // Call the Microsoft Graph API. Get the drives collection page.
                DriveItemChildrenCollectionPage library = (DriveItemChildrenCollectionPage)graphClient.Sites[siteSearchResults[0].Id]
                                                          .Drives[drives[0].Id]
                                                          .Root
                                                          .Children
                                                          .Request()
                                                          .GetAsync()
                                                          .Result;

                Assert.True(library.Count > 0, "Expected at least one driveitem result. Got zero. Check test data.");
            }
            catch (Microsoft.Graph.ServiceException e)
            {
                Assert.True(false, $"Something happened, check out a trace. Error code: {e.Error.Code}");
            }
        }