I have a requirement to create Components based on a Schema via Core Service. The content will be coming from an Excel spreadsheet. I was able to handle most of the field types, except one with KeywordFieldDefinitionData
. To add to the complexity it's a multi valued field.
The content I get from Excel for that field is a list Ex. "IN", "JP", "US". How can I add these Keywords to the multi valued field? My sample data:
comp.Metadata
<Metadata xmlns="uuid:5f855153-bb88-4796-826b-efef6985bfad">
<AssetType>Multimedia Document</AssetType>
<ContentType>Case Study</ContentType>
<ContentType>Research Report</ContentType>
<Audience>Customers</Audience>
<Audience>Partners</Audience>
<Industry>Financial Services</Industry>
<Industry>Media & Entertainment</Industry>
<Industry>Online Gaming</Industry>
<Country>IN</Country>
<Country>JP</Country>
<Country>KR</Country>
<Country>US</Country>
<ProductFamily>Cloud Networking</ProductFamily>
<Product>Kona Web Application Firewall</Product>
<ActualCreationDate>2014-04-14T18:28:37</ActualCreationDate>
<ModifiedDate>2017-04-14T18:31:36</ModifiedDate>
<DisplayStatus>Active</DisplayStatus>
</Metadata>
Code:
//Metadata Fields
var metadataFields = Fields.ForMetadataOf(schemaFields, component);
metadataFields["AssetType"].Value = (firstSheet.Cells[rowIdx, 10].Value).ToString();
//what to do here
metadataFields["ContentType"].Value = (firstSheet.Cells[rowIdx, 11].Value).ToString();
metadataFields["ContentType"].Value = (firstSheet.Cells[rowIdx, 12].Value).ToString();
metadataFields["Audience"].Value = (firstSheet.Cells[rowIdx, 13].Value).ToString();
metadataFields["Industry"].Value = (firstSheet.Cells[rowIdx, 14].Value).ToString();
metadataFields["Country"].Value = (firstSheet.Cells[rowIdx, 15].Value).ToString();
metadataFields["ProductFamily"].Value = (firstSheet.Cells[rowIdx, 16].Value).ToString();
metadataFields["Product"].Value = (firstSheet.Cells[rowIdx, 17].Value).ToString();
metadataFields["ActualCreationDate"].Value = (firstSheet.Cells[rowIdx, 18].Value).ToString();
metadataFields["ModifiedDate"].Value = (firstSheet.Cells[rowIdx, 19].Value).ToString();
if (((firstSheet.Cells[rowIdx, 20].Value).ToString()) != null)
metadataFields["CampaignID"].Value = (firstSheet.Cells[rowIdx, 20].Value).ToString();
metadataFields["DisplayStatus"].Value = (firstSheet.Cells[rowIdx, 21].Value).ToString();
component.Metadata = metadataFields.ToString();