Hello,
I am having no success in setting the value of a Managed Metadata field which is contained in a DocumentSet.
My O365 SharePoint site has a custom ContentType of type DocumentSet. The DocumentSet has a custom column which is bound to a Managed Metadata Term Set.
I am reading in a value from an XML file. The value I am reading in represents a value already contained in the Managed Metadata TermSet. I would like to programmatically set the field value in the DocumentSet to the value I have read in from the XML.
e.g. value read in = "lastNameX, firstNameX"
The TermSets has the Terms "lastNameW, firstNameW, "lastNameX, firstNameX", "lastNameY, firstNameY"
When I retrieve the DocumentSet the custom column "Emp Name" is blank and I would like it to be "lastNameX, firstNameX" after the update.
My program can successfully perform the following:
Create the DocumentSet
Recall the DocumentSet
Recall the TermId from the TermStore
Update non Managed Metadata fields in the DocumentSet
I read this http://social.technet.microsoft.com/wiki/contents/articles/21801.sharepoint-a-complete-guide-to-getting-and-setting-fields-using-c.aspx#Setting_and_Getting_a_Managed_Metadata_Field
but the first line: var managedMetaDataField = list.Fields[
"managedmetadatafield"
]
as
TaxonomyField;
yields the error: cannot convert from string to int
Thank you in advance.