Dans SharePoint 2013, catalogue de produits - Comment ajouter par programme une balise à la colonne Catégorie d'élément de la liste des produits?
-
09-12-2019 - |
Question
J'ai une webpart personnalisé pour ajouter un élément à la liste des produits, j'ai besoin d'un moyen d'ajouter des balises à la colonne Catagory d'élément de la liste (Programmatique).
Comment puis-je le faire!
La 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
Autres conseils
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
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange