I have searched before asking this question. Also, I have done as suggested by this answer https://sharepoint.stackexchange.com/a/83794/81955 but my problem still persists.

My scenario: I have 2 hub sites, mycompany.sharepoint.com/sites/A and mycompany.sharepoint.com/sites/B. Site A has a content type called Account Management with some Managed Metadata Fields. I want to clone the content type and its fields on site B, so I get the list of Field from site A and create them on site B with this code

Field newField = clientContext.Site.RootWeb.Fields.AddFieldAsXml(fieldXmlSchema, true, AddFieldOptions.AddToNoContentType);

Then I link this field to the new content type with this code

FieldLinkCreationInformation fieldLink = new FieldLinkCreationInformation
                                            Field = newField 

After this, my site B shows the new content type with the exact set of columns as site A, however, when I try adding a value to the Managed Metadata column, this error shows up on SharePoint properties panel The SPListItem being updated was not retrieved with all taxonomy fields.

The same error also shows if I use CSOM to set the value.

TaxonomyField txField = context.CastTo<TaxonomyField>(myManagedMetadataField);
TaxonomyFieldValue termValue = new TaxonomyFieldValue();
termValue.TermGuid = termId;
termValue.WssId = -1;
txField.SetFieldValueByValue(newFile.ListItemAllFields, termValue);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.