Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a TermSet called "Products" inside Term Store Management/Managed Metadatam, I am designing a front end form which allow user's to submit data to this list, to load the Product dropdown I need to pull all the available Items/Value from this Managed Metadata List.

I am not able to figure out how to build the CAML query for this, How to get the names of particular "Products" from Term store or get it using Client Object Modal (with SharePoint 2010).

Any help would be highly appreciated.

Vishal

share|improve this question
add comment

1 Answer

This will probably help:

http://blogs.msdn.com/b/sharepointdev/archive/2011/11/18/how-to-work-with-managed-metadata-columns-by-using-the-sharepoint-client-object-model-kaushalendra-kumar.aspx

Here's what i've done to get the items:

    ClientContext hrMainCtx = new ClientContext(siteURLhere);
    hrMainCtx.Credentials = new NetworkCredential("username", "password", "domain");

    List taxonomyHiddenList = hrMainCtx.Web.Lists.GetByTitle("TaxonomyHiddenList");
    ListItemCollection taxonomyListCol = taxonomyHiddenList.GetItems(CamlQuery.CreateAllItemsQuery());
    hrMainCtx.Load(taxonomyListCol);
    hrMainCtx.Load(taxonomyHiddenList);
    hrMainCtx.ExecuteQuery();

then for querying I've done something like this to get the specific items:

    foreach (ListItem oListItem in taxonomyListCol)
    {
        if (oListItem.FieldValues["Path"].ToString() == countryName) 
        {
            countryID = oListItem.FieldValues["ID"].ToString();
            countryTermID = oListItem.FieldValues["IdForTerm"].ToString();
        }
        else if (oListItem.FieldValues["Path"].ToString() == physLocation) 
        {
            phyLocID = oListItem.FieldValues["ID"].ToString();
            phyLocTermID = oListItem.FieldValues["IdForTerm"].ToString();
        }
    }

hopefully this will give you some idea on how to get the items from the hidden list...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.