Skip to main content
Updated the Explanation
Source Link
TARUN
  • 2.9k
  • 20
  • 45

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.

Taxonomyfiledar

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..

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.

Taxonomyfiledar

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();

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.

Taxonomyfiledar

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..

Tweeted twitter.com/StackSharePoint/status/846198697155211264
added 26 characters in body
Source Link
TARUN
  • 2.9k
  • 20
  • 45

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.

Taxonomyfiledar

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();

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.

Taxonomyfiledar

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();

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.

Taxonomyfiledar

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();
updated the Tags
Link
TARUN
  • 2.9k
  • 20
  • 45
Source Link
TARUN
  • 2.9k
  • 20
  • 45
Loading