This is a view mode object that will be passed by the client to the service for getting the taxonomy hierarchy and this is used in taxonomy controller
Пример #1
0
        public async void Get_Taxonomy_Hierarchy_For_Clients()
        {

            var termStoreViewModel = new TermStoreViewModel()
            {
                Client = new Client()
                {
                    Id = "123456",
                    Name = "Microsoft",
                    Url = "https://msmatter.sharepoint.com/sites/catalog"
                },
                TermStoreDetails = new TermStoreDetails()
                {
                    TermGroup = "MatterCenterTerms",
                    TermSetName = "Clients",
                    CustomPropertyName = "ClientURL"
                }
            };

            using (var client = testServer.CreateClient().AcceptJson())
            {
                var response = await client.PostAsJsonAsync("http://localhost:58775/api/v1/taxonomy/gettaxonomy", termStoreViewModel);
                var result = response.Content.ReadAsJsonAsync<ClientTermSets>().Result;
                Assert.NotNull(result);
                Assert.NotEmpty(result.ClientTerms);             
            }
        }
Пример #2
0
 /// <summary>
 /// This method will get the taxonomy hierarchy object for the given search criterai and return to the service
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="termStoreViewModel">The request object for which the taxonomy has to be retrieved</param>
 /// <returns>Client TermSet or SPO TermSet</returns>
 public async Task<TaxonomyResponseVM> GetTaxonomyHierarchyAsync(TermStoreViewModel termStoreViewModel)
 {
     return await Task.FromResult(taxonomy.GetTaxonomyHierarchy(termStoreViewModel.Client, termStoreViewModel.TermStoreDetails));
 }
Пример #3
0
        public async void Internal_Server_Error()
        {

            var termStoreViewModel = new TermStoreViewModel()
            {
                Client = new Client()
                {
                    Id = "123456",
                    Name = "Microsoft",
                    Url = "https://microsoft.sharepoint.com/teams/mcuisite1234"
                },
                TermStoreDetails = new TermStoreDetails()
                {
                    TermGroup = "Site Collection - microsoft.sharepoint.com-teams-mcuisite",
                    TermSetName = "NoClients",
                    CustomPropertyName = "ClientURL"
                }
            };

            using (var client = testServer.CreateClient().AcceptJson())
            {
                var response = await client.PostAsJsonAsync("http://localhost:58775/api/v1/taxonomy/gettaxonomy", termStoreViewModel);
                var result = response.Content.ReadAsJsonAsync<ErrorResponse>().Result;       
                Assert.NotNull(result);
                Assert.Equal("500", result.ErrorCode);
            }
        }
Пример #4
0
 public IActionResult GetCurrentSiteTitle()
 {
     var termStoreViewModel1 = new TermStoreViewModel()
     {
         Client = new Client()
         {
             Id = "123456",
             Name = "Disney",
             Url = "https://microsoft.sharepoint.com/teams/mcuisite"
         },
         TermStoreDetails = new TermStoreDetails()
         {
             TermGroup = "Site Collection - microsoft.sharepoint.com-teams-mcuisite",
             TermSetName = "Clients",
             CustomPropertyName = "ClientURL"
         }
     };
     
     string siteName = string.Empty;
     spoAuthorization.AccessToken = HttpContext.Request.Headers["Authorization"];
    
     siteName = taxonomyRepository.GetCurrentSiteName(termStoreViewModel1.Client);
     var success = new 
     {
         Title = siteName
     };
     return matterCenterServiceFunctions.ServiceResponse(success, (int)HttpStatusCode.OK);
 }