1

I have got parent term's WSSID by this method. How do i get its child terms ids like this to build my CAML query for search in a share point list using CSOM

private static int GetWssIdByTermId(ClientContext clientContext, string termGuidString)

    {
        int result = 0;
        Web web = clientContext.Site.RootWeb;
        List list = web.Lists.GetByTitle("TaxonomyHiddenList");
        var q = new CamlQuery()
        {
            ViewXml =
               String.Format(@" <View>
                        <Query>
                           <Where>
                              <Eq>
                                 <FieldRef Name='IdForTerm' />
                                 <Value Type='Text'>{0}</Value>
                              </Eq>
                           </Where>
                        </Query>
                     </View>",
                  termGuidString)
        };
        var items = list.GetItems(q);
        clientContext.Load(items);
        clientContext.ExecuteQuery();
        if (items.Count == 1)
        {
            result = int.Parse(items[0]["ID"].ToString());
        }
        return result;
    }

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.