1

I have the following code to set the column default values for a library:-

var corpTypetaxValue = listItem["CorpType"] as TaxonomyFieldValueCollection;
var corpTypeFieldValueArray = corpTypetaxValue.Select(taxonomyFieldValue => $"1033;#{taxonomyFieldValue.Label}|{taxonomyFieldValue.TermGuid}");
context.ExecuteQuery();
var ttt = String.Join(";", corpTypeFieldValueArray);  
bb.SetFieldDefault(context.Web.GetFolderByServerRelativeUrl(webrelativeurl + "/" + i2["TemplateListUrl"].ToString()+ "/"+mainfoldername.ToString()), "CorpType", String.Join(";", corpTypeFieldValueArray)); 

the above code will work well if the CorpType contain single term, but if it contain multiple terms I will get this error when I try to modify the column defaults from the UI:

The given value for a taxonomy field was not formatted in the required ;#| format.

1
  • How you are adding multiple terms? Can you share the code you are using for that? Feb 20, 2020 at 11:34

1 Answer 1

2

To include multiple taxonomy values, the values should be separated by ;#.

Example:

44;#USA|c1815b1d-346f-4ce1-b2cb-15df5e12b0b3;#45;#INDIA|e141d775-7a3b-40aa-a680-98039b375828

Source:

Update Managed Metadata column Default Value(s) using CSOM - C#

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.