Nick Nick - 9 months ago 64 Question

Sharepoint Updating MMS DocumentSet field

I have am writing some SharePoint 2013 integration to my companies product, to upload a document set with metadata and then upload some documents.
I have all this functionality working correctly, except for updating Document Set metadata fields that require MMS (Managed Metadata Service) fields.

dim docSetUrl as string = "http://someurl/"
Dim folder = Context.Web.GetFolderByServerRelativeUrl(docSetUrl)
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

Now as you can see from the code, I can update the
which just requires a string value, but for the Applicant object which is a MMS type, it just doesn't change (no errors).

If I log into SharePoint and manually use MMS to select an item, and then programatically check what it's value is : 353;#: Value A : REC-95342|9074b95b-9dcd-4c93-b548-32a5c7e7e083, if I clear the value manually and then try to push the found value back in, I still have no result.

How am I supposed to update a MMS field?



I was able to piece this together via lots of input from different sources. Such as

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)