1

I am getting extra column which as per the result seems to be associated with the metadata column when I am fetching the data from a list in o365 and exporting in excel. I am not getting those columns when there is no metadata column. I want to remove those columns from my output.

else if (type == "Microsoft.SharePoint.Client.Taxonomy.TaxonomyFieldValueCollection")
{
    TaxonomyFieldValueCollection taxFieldValueColl = item[obj.Key] as TaxonomyFieldValueCollection;

    // Loop through all the taxonomy field values
    string itemvalue = string.Empty;
    if (chkTaxanomycolumn.Checked)
    {
        foreach (TaxonomyFieldValue taxFieldValue in taxFieldValueColl)
        {
            var guid = Guid.Parse(taxFieldValue.TermGuid);
            var taxonomy = TaxonomySession.GetTaxonomySession(clientContext);
            var term = taxonomy.GetTerm(guid);
            clientContext.Load(term);
            clientContext.ExecuteQuery();

            var path = term.PathOfTerm; // Taxanomy path seperator selection

            // Display the taxonomy field value
            itemvalue = itemvalue + path + ";";
        }
    }
    else
    {
        foreach (TaxonomyFieldValue taxFieldValue in taxFieldValueColl)
        {
            // Display the taxonomy field value                                            
            itemvalue = itemvalue + taxFieldValue.Label + ";";
        }
    }

    dr[obj.Key] = itemvalue;

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.