Can we tag assets with asset media using the WebClient SDK? For example, some of our assets are not tagged with any asset media. We're not sure how or why this happened because when an asset is created in Content Hub, it's automatically tagged with the relevant taxonomy.

As a result, the 'asset media' property is blank on the asset detail page, which also prevents us from seeing the 'Create Rendition' button on the asset detail page.

enter image description here

Previously, we created a Sitecore ticket for this issue, and they advised us to perform a 'refresh rendition' with 'Failed only' unchecked. This method worked, but we have more than 250,000 assets, and the 'refresh rendition' is a resource-intensive operation. So, we've been considering an alternative approach.

What I've tried to do is to retrieve the file name, get the file extension, match it with the asset media taxonomy, and then attempt to tag it with asset media using the WebClient SDK. I've successfully used this approach with other taxonomies in the past. However, with asset media, it's not working, even though I've double-checked the code.

So, my question is, can we update the 'asset media' property of an asset using the WebClient SDK?

Update-1 Sharing the code snipped

var config = new Stylelabs.M.Framework.Essentials.LoadConfigurations.EntityLoadConfiguration(
                    new PropertyLoadOption("Title", "renditiontracker", "FileName"),
                     new RelationLoadOption("AssetMediaToAsset")

                IEntity entity = await _mclient.Entities.GetAsync(Convert.ToInt32(assetId), config);
                var fileName = entity.GetPropertyValue("FileName").ToString();
                string fileExtensionWithDot = Path.GetExtension(fileName).ToLowerInvariant();
                string fileExtension = fileExtensionWithDot.TrimStart('.');

                var AssetMediaToAssetRelation = entity.GetRelation("AssetMediaToAsset");
                if (fileExtension == "jpg")
                if (fileExtension == "png")
                if (fileExtension == "gif")
                if (fileExtension == "jpeg")

                long entityNewId = await _mclient.Entities.SaveAsync(entity);
  • 1
    Sound like you are doing the right thing. It will help if you can share details of the piece of code that you believe is not working? Have you debugged, any useful information at the code level? Any errors, warnings?
    – Julius A
    Oct 18, 2023 at 13:39
  • @JuliusA shared the code and updated the question, I am not getting any warnings or error messages, code simply save the asset but not showing into the portal.
    – Gautam
    Oct 18, 2023 at 13:47

2 Answers 2


We have created a Sitecore ticket for this, and here is the response we received from them:

The reason you can't modify the asset media value on an asset is that this relation has 'allow updates' set to false by design.

Therefore, there's no way to modify this value through M.Asset, neither through the SDK nor from the UI. 

So the only option for us is to refresh the renditions.

I hope this information will be helpful to the Sitecore community.


The issue with the code you shared seems to be around how you have loaded the AssetMediaToAsset relation. You need to specify which is the cardinality of the relation.

Try replacing with this code:

var assetMediaToAssetRelation = entity.GetRelation<IChildToManyParentsRelation>("AssetMediaToAsset");

You can also try and use _mclient.Logger.Info("..."); to log info to help debug and verify your objects are working.

Edit: Change from IParentToManyChildrenRelation to IChildToManyParentsRelation

  • Thanks Julius A, I tried it with that code but now assetMediaToAssetRelation is getting null.
    – Gautam
    Oct 19, 2023 at 5:16
  • I think I may have gotten the child-parent relation wrong. Since M.Asset is a Child of M.AssetMedia, then this should be IChildToManyParentsRelation. If this does not work, try with IChildToOneParentRelation Hope this helps.
    – Julius A
    Oct 19, 2023 at 7:56
  • 1
    Still no luck Julius, tried both. I will create a sitecore ticket and will update you.
    – Gautam
    Oct 19, 2023 at 8:32
  • 1
    Created a sitecore ticket and added the response in my Answer.
    – Gautam
    Nov 7, 2023 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.