In sharepoint 2013 , product catalog - How to programmatically add a tag to the Item Category column in the product list?
-
09-12-2019 - |
Question
I have a custom webpart to add an item to the product list, i need a way to add tags to the item catagory column in the list (programmatically).
How do I do it !
Solution 2
i figured out a way to do this TaxonomyFieldValueCollection TagsCat = new TaxonomyFieldValueCollection(String.Empty); TagsCat.PopulateFromLabelGuidPairs(TaxonomyWebTaggingControl1.Text);
var taxKeywordField = oSpListItem.Fields.GetField("ProductCatalogItemCategory") as TaxonomyField;
taxKeywordField.CreateValuesInEditForm = true;
try
{
taxKeywordField.ParseAndSetValue(oSpListItem, TagsCat[0].TermGuid);
}
catch (Exception e2)
{
}
oSpListItem.Update();
This worked for me
OTHER TIPS
Take a look at these scripts on TechNet. The script starting with 5 is updating the Item Category column. http://gallery.technet.microsoft.com/Import-list-content-to-f735d7fb
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange