Provides the structure required for client term set. It includes term set name and list of terms under the term set.
예제 #1
0
        /// <summary>
        /// This method will get all client term properties such as ID and URL
        /// </summary>
        /// <param name="termColl">The taxonomy client terms</param>
        /// <param name="termStoreDetails">The term store details which the UI has sent to the clients</param>
        /// <param name="clientTermSet">The ClientTermSets object to which all the client terms are added</param>
        /// <returns></returns>
        private ClientTermSets GetClientTermProperties(TermCollection termColl, TermStoreDetails termStoreDetails, ClientTermSets clientTermSet)
        {
            try
            {
                foreach (Term term in termColl)
                {
                    Client tempTermPG = new Client();
                    tempTermPG.Name = term.Name;
                    if (term.CustomProperties.Count > 0)
                    {
                        tempTermPG.Url = string.Empty;
                        tempTermPG.Id = string.Empty;
                        foreach (KeyValuePair<string, string> customProperty in term.CustomProperties)
                        {
                            if (customProperty.Key.Equals(termStoreDetails.CustomPropertyName, StringComparison.Ordinal))
                            {
                                tempTermPG.Url = customProperty.Value;
                            }

                            if (customProperty.Key.Equals(taxonomySettings.ClientCustomPropertiesId, StringComparison.Ordinal))
                            {
                                tempTermPG.Id = customProperty.Value;
                            }
                        }
                    }
                    if(!string.IsNullOrWhiteSpace(tempTermPG.Id) && !string.IsNullOrWhiteSpace(tempTermPG.Url))
                    {
                        clientTermSet.ClientTerms.Add(tempTermPG);
                    }                    
                }
                return clientTermSet;
            }
            catch (Exception ex)
            {
                customLogger.LogError(ex, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable);
                throw;
            }
        }
예제 #2
0
 /// <summary>
 /// This method will be called if the clients are defined as term set and not as terms
 /// </summary>
 /// <param name="termSet">Term set object holding Client terms</param>
 /// <param name="termStoreDetails">Term Store object containing Term store data</param>
 /// <returns>Serialized Object of Client Term Set</returns>
 private ClientTermSets GetClientTermSetHierarchy(ClientContext clientContext, TermSet termSet, TermStoreDetails termStoreDetails)
 {
     ClientTermSets tempClientTermSet = new ClientTermSets();
     try
     {
         tempClientTermSet.Name = taxonomySettings.ClientTermSetName;
         /////Retrieve the Terms - level 1
         tempClientTermSet.ClientTerms = new List<Client>();
         TermCollection termColl = null;  
         termColl = termSet.Terms;
         return GetClientTermProperties(termColl, termStoreDetails, tempClientTermSet);
     }
     catch (Exception ex)
     {
         customLogger.LogError(ex, MethodBase.GetCurrentMethod().DeclaringType.Name, 
             MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable);
         throw;
     }            
     
 }