I'm trying to hook up some Site Columns (TaxonomyFields) to Term Sets in the the local (SiteCollection) term store. In some cases I may need to actually create the term sets and this code will be running as a FeatureReceiver on the Feature that is provisioning the SiteColumns (in CAML). So, I'm able to do this:
var session = new TaxonomySession(site); var termStore = session.DefaultSiteCollectionTermStore;
But now how do I get the proper taxonomy group (the one private to my site collection) from the termStore.Groups collection? Do I really have to just loop through it looking for "Site Collection - SCHostname-path-to-site" and hope that funky url translation works out and that there are no odd access mappings at play? That seems very sloppy and I have to believe I'm approaching this wrong. Is there a way to find out the current site's "group association" so I can just call termStore.GetGroup(id)?