unable to Create Term Within a TermSet RRS feed

  • Question

  • Hi,
    I am trying to create term inside an existing termset. Following is my code

    I am trying to create a term if it doesn't exist in termset. Following is my code

    using (SPSite mySite=new SPSite(URL,SPUserToken.SystemUser))
    uisng (SPWEb myWeb= mySite.OpenWeb())
    TaxonomySession session = new TaxonomySession(myWeb.Site);
    TermStore termStore = session.TermStores[TermStoreName];
    Group group = termStore.Groups("testGroupName");
    //var termSet = group.TermSets["existingTermSet"];
    TermSet ts=null;
    int lcid = CultureInfo.CurrentCulture.LCID;

    This throws an error saying "Value cannot be null" in the following line:

    I am really puzzled by this error.

    Please suggest me an alternative or root cause so that I can proceed. I am at a loss right now.

    I have to use Server Side Object Model and not CSOM

    • Edited by SouravBiki Thursday, April 3, 2014 7:05 PM
    Thursday, April 3, 2014 7:02 PM

All replies