Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
using Digizuite.Api.Core.Shared.Model; //from Digizuite.Api.Core.AspNet
private readonly IDigizuiteClient _client; //from Digizuite.Episerver

private void AddSkuToDamAsset(ContentReference assetLink, string skuCode)
{
    var content = _contentLoader.Get<IDigizuiteContent>(assetLink);
    if (!String.IsNullOrEmpty(skuCode) && content != null) {
        List<MetadataValue> lst = new List<MetadataValue>();
        //use metafieldLabelid from Digizuite center
        lst.Add(new MetadataValue("51992", MetadataFieldType.EditMultiComboValue.ToString(), 
            new string[] { skuCode }, BatchUpdateType.Asset));
        var res = _client.Configuration.MetaDataService.UpdateMetadata(content.ItemId, lst).Result;

        if (!res.Success)
        {
            resultMessage += res.Error + "<br/>";
        }
    }
}

Result in DAM:

...