Does anyone have any idea how can I bind a term set to the quick launch in SP2013 programmatically? I used the UI but I am getting the same link for both top navigation and quick launch. Any examples or links will be very helpfull
1 Answer
web.AllowUnsafeUpdates = true;
SPField field = list.Fields[Constant.docLibViewMetaData];
MetadataNavigationSettings listNavSettings = MetadataNavigationSettings.GetMetadataNavigationSettings(list);
MetadataNavigationHierarchy mdnNavHierarchy = new MetadataNavigationHierarchy(field);
listNavSettings.ClearConfiguredHierarchies();
listNavSettings.AddConfiguredHierarchy(MetadataNavigationHierarchy.CreateFolderHierarchy());
listNavSettings.AddConfiguredHierarchy(mdnNavHierarchy);
MetadataNavigationSettings.SetMetadataNavigationSettings(list, listNavSettings, true);
list.RootFolder.Update();
list.Update();
web.AllowUnsafeUpdates = false;