Posts

Showing posts with the label term

CreateTerm / CreateLabel error

in sharepoint 2013 taxonomy, i tried to add terms to an existing TermSet. the code i used gave me an arror                 string example = txtExample.Text;                 Term t = selectedT.CreateTerm(example, 1037);                 t.CreateLabel(example, 1037, true); where selectedT is just another term. the error i got "Violation of PRIMARY KEY constraint IX_ECMTermLabel_PartitionIdTermIdLCIDLabel Cannot insert duplicate key in object dbo.ECMTermLabel The duplicate key value is (0c37852b-34d0-418e-91c6-2ac25af4be5b, 607, 1037, 33)" the solution was NOT using CreateLabel.

Serialize (map) TermsSet / Term

i should edit this sometime, but currently here is the code public class ComplexMappedTerm { public static int LCID { get ; set ; } public Guid ID { get ; set ; } public string Label { get ; set ; } public int ChildrenCount { get ; set ; } public string Path { get ; set ; } public List < ComplexMappedTerm > Children { get ; set ; } private ComplexMappedTerm() { } public static ComplexMappedTerm BuildTree( TermSetItem tsi) { if (LCID == 0) { throw new ArgumentException ( "TermMap - Must set static property LCID before using mapping functions" ); } if (tsi is Term ) { return Map(tsi as Term ); } if (tsi is TermSet ) { return Map(tsi as TermSet ); } return null ; } static ComplexMappedTerm Map( Term t) { List < ComplexMappedT...