Table of Contents

AsAdam(...) Command


ADAM is the Automatic Digital Asset Manager. It manages files (Assets) for content in 2sxc.

The files are managed so that they really belong to the item they are used in.
Read more about ADAM

When a content-item has a Library field (see Field Input-Type hyperlink-library) your code needs to get a list of all the files and folders of that field. For example to show galleries. This is where AsAdam(...) comes in. It gives you the ADAM parts of this field.

⚡ The official API docs.

Basically all you need for AsAdam(...) is

  1. The Content Item (Entity or DynamicEntity)
  2. The field name of which you want the Adam objects

As a result you'll get an IFolder object with which you can get all files in the folder or subfolders.

Discover More in the Razor Tutorials

We have an rich series of Razor tutorials. You should really check them out 👍.


This example is taken from the Fancybox Gallery App

@inherits Custom.Hybrid.Razor12
@using ToSic.Razor.Blade;
@using Dynlist = System.Collections.Generic.IEnumerable<dynamic>;

<div class="ga-wrapper">
  <div class="ga-albums row">
    @foreach (var album in AsList(Data)) {
      var images = AsAdam(album, "Images").Files as Dynlist;
      var albumThumbUrl = Text.Has(album.AlbumThumbnail)
        ? album.AlbumThumbnail
        : images.First().Url;

      <div class="ga-album col-12 col-sm-6 col-md-6 col-lg-4" @Edit.TagToolbar(album)>
        <a href='@Tags.SafeUrl(Link.To(parameters: "mid/" + Dnn.Module.ModuleID + "&album=" + album.Path))'>
          <div class="ga-img">
            <div class="overlay">
              <div class="ga-album-title"><h5 class="ga-title">@album.Title</h5></div>
              <div class="ga-files-count"><span class="badge badge-pill badge-dark float-end">@images.Count()</span></div>
            <img class="img-fluid" src='@Tags.SafeUrl(albumThumbUrl + "?w=720&h=500&mode=crop&scale=both&quality=80")' alt="@album.Title" />

We suggest you check out some apps which use ADAM to see how they work.

Also Read


  1. General Tokens introduced in 2sxc 8.0
  2. Added extra security switch in 2sxc 9.32