I am trying to Copy a Document having the Managed Metadata(Termsets) fields from one site collection to another site collection in SharePoint online using CSOM. The Managed Metadata Fields are there in both the Document libraries with different Internal names but with same display name. The Columns names are shown in below image. After Copying the document only Topic filed data is copied without any additional coding.
So I tried the below code to copy Managed Metadata(Termsets) fields after Uploading the file with internals names but the fields are not updating.
foreach (var stritem in Taxonomyfiledarray)
{
TaxonomyFieldValueCollection sourceValue = SourcelistItem[stritem.Source] as TaxonomyFieldValueCollection;
string[] termValuesarrary;
List<string> termValues = new List<string>();
foreach (TaxonomyFieldValue taxProductFieldValue in sourceValue)
{
termValues.Add(taxProductFieldValue.Label + "|" + taxProductFieldValue.TermGuid);
}
termValuesarrary = termValues.ToArray();
string termValuesstring = string.Join(";", termValuesarrary);
itemToCreate[stritem.Destination] = termValuesstring;
}
itemToCreate.Update();
Any Suggestion please..