Versions Compared

Key

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

...

  1. BIT
    Use the Digizuite service IAssetSearchService and IMetadataValueService.
    First we fetch the asset. Then creates a new instance of BitMetadataUpdate. The TargetItemIds is the itemId of the asset we just fetched. The MetaFieldItemGuid is the GUID of the metafield you wants to update. As you can see in the ApplyUpdate, it takes a list of updates. So you have the options to bulk update metadata for an asset.

    Code Block
    var assetSearchService = app.Services.GetRequiredService<IAssetSearchService>();
    var metadataValueService = app.Services.GetRequiredService<IMetadataValueService>();
    var asset = await assetSearchService.GetAsset(75);
    var bitMetadataUpdatemetadataUpdate = new BitMetadataUpdate
    {
        Value = true,
        TargetItemIds = new HashSet<int> { asset.ItemId },
        MetaFieldItemGuid = Guid.Parse("7072a817-abdf-469b-9042-f281189d52fa")
    };
    await metadataValueService.ApplyUpdate<MetadataUpdate>(new[] { bitMetadataUpdate metadataUpdate});
  2. INT
    Use the Digizuite service IAssetSearchService and IMetadataValueService.
    First we fetch the asset. Then creates a new instance of IntMetadataUpdate. The TargetItemIds is the itemId of the asset we just fetched. The MetaFieldItemGuid is the GUID of the metafield you wants to update. As you can see in the ApplyUpdate, it takes a list of updates. So you have the options to bulk update metadata for an asset.

    Code Block
    var assetSearchService = app.Services.GetRequiredService<IAssetSearchService>();
    var metadataValueService = app.Services.GetRequiredService<IMetadataValueService>();
    var asset = await assetSearchService.GetAsset(75);
    var metadataUpdate = new IntMetadataUpdate
    {
        Value = 99,
        TargetItemIds = new HashSet<int> { asset.ItemId },
        MetaFieldItemGuid = Guid.Parse("7072a817-abdf-469b-9042-f281189d52fa")
    };
    await metadataValueService.ApplyUpdate<MetadataUpdate>(new[] { metadataUpdate});
  3. STRING

  4. COMBOVALUE

  5. MULTICOMBOVALUE

  6. DATETIME

  7. TREE

  8. EDITCOMBOVALUE

  9. EDITMULTICOMBOVALUE

...