在SharePoint 2013中,产品目录 - 如何以编程方式向产品列表中的项目类别列添加标记?

sharepoint.stackexchange https://sharepoint.stackexchange.com//questions/49328

  •  09-12-2019
  •  | 
  •  

我有一个自定义webpart要将项目添加到产品列表中,我需要一种方法来将标记添加到列表中的项目catagory列(以编程方式)。

我该怎么做!

有帮助吗?

解决方案 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

其他提示

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

许可以下: CC-BY-SA归因
scroll top