Which code segment should you add at line 04?

You need to create a Web Part that adds a term set to the current SharePoint site collection’s term store.

You write the following code segment. (Line numbers are included for reference only.)

01 System.Web.UI.WebControls.TextBox txtBoxTermSetToAdd = new System.Web.UI.WebControls.TextBox();
02 TaxonomySession session = new TaxonomySession(SPContext.Current.Site);
03 TermSet addedTerm = session.TermStores[0].Groups[“MyNewTermStore”].CreateTermSet(txtBoxTermSetToAdd.Text);
04

Which code segment should you add at line 04?

You need to create a Web Part that adds a term set to the current SharePoint site collection’s term store.

You write the following code segment. (Line numbers are included for reference only.)

01 System.Web.UI.WebControls.TextBox txtBoxTermSetToAdd = new System.Web.UI.WebControls.TextBox();
02 TaxonomySession session = new TaxonomySession(SPContext.Current.Site);
03 TermSet addedTerm = session.TermStores[0].Groups[“MyNewTermStore”].CreateTermSet(txtBoxTermSetToAdd.Text);
04

Which code segment should you add at line 04?

A.
addedTerm.Export();

B.
addedTerm.TermStore.CommitAll();

C.
SPContext.Current.Site.WebApplication.Update();

D.
SPContext.Current.Web.AllowUnsafeUpdates = true;

Explanation:
MNEMONIC RULE: “add a term set = TermStore.CommitAll()”

Term Class
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.taxonomy.term.aspx



Leave a Reply 0

Your email address will not be published. Required fields are marked *