Sharepoint更新MMS DocumentSet字段

时间:2016-05-06 04:03:22

标签: asp.net vb.net sharepoint sharepoint-2013

我正在为我的公司产品编写一些SharePoint 2013集成,上传包含元数据的文档集,然后上传一些文档。 除了更新需要MMS(托管元数据服务)字段的文档集元数据字段外,我所有这些功能都正常工作。

dim docSetUrl as string = "http://someurl/"
Dim folder = Context.Web.GetFolderByServerRelativeUrl(docSetUrl)
Context.Load(folder)
Context.ExecuteQuery()
folder.Properties.Item("GeoObject") = "test" 'Normal string content (updates correctly)
folder.Properties.Item("Applicant") = "1353;#: Value A : REC-95342|9074b95b-9dcd-4c93-b548-32a5c7e7e083" 'Does not update correctly
folder.Update()
Context.ExecuteQuery()

现在您可以从代码中看到,我可以更新只需要字符串值的GeoObject,但对于MMS类型的Applicant对象,它只是不会更改(没有错误) )。

如果我登录SharePoint并手动使用MMS选择项目,然后以编程方式检查它的值是什么: 353;#:值A:REC-95342 | 9074b95b-9dcd-4c93- b548-32a5c7e7e083 ,如果我手动清除该值然后尝试将找到的值重新推入,我仍然没有结果。

我应该如何更新彩信领域?

谢谢,

1 个答案:

答案 0 :(得分:0)

我能够通过来自不同来源的大量输入将其拼凑​​在一起。例如https://unnieayilliath.com/2015/08/24/sharepoint-2013-updateclear-taxonomy-field-value-using-c-csom/

Dim value As TaxonomyFieldValue = New TaxonomyFieldValue()
                value.WssId = -1
                value.TermGuid = terms.First.Id.ToString
                value.Label = terms.First.Name

                Dim list As List = folder.ListItemAllFields.ParentList
                Dim field As Field = list.Fields.GetByInternalNameOrTitle("Property")

                Dim txField As TaxonomyField = Context.CastTo(Of TaxonomyField)(field)

                txField.SetFieldValueByValue(folder.ListItemAllFields, value)
                folder.ListItemAllFields.Update()
                Context.Load(folder.ListItemAllFields)
                Context.ExecuteQuery()