My project uses Sitecore as a Front-End and ADAM as a Photo-Storage, the task is - display a list of specific records(Name, Description and Picture).
Because ADAM's documentation is hard to find, I'm going to provide the code :)
First of all we need to create a Template, that will have just one TextFiled with the Record Guids that we need to display.
First of all we need to create a Template, that will have just one TextFiled with the Record Guids that we need to display.
var app = new Application();
if (app.LogOn(Configuration.Settings.Registration, Configuration.Settings.AdamName, Configuration.Settings.AdminPassword) == LogOnStatus.LoggedOn)
{
try
{
foreach (var assetId in AssetList.Records.Split(','))
{
var record = new Record(app);
record.Load(new Guid(assetId));
Records.Add(record.Files.Master.GetPreview().GetPath(), record.Fields["Name"]);
}
}
finally
{
app.LogOff();
}
}
And just display it in a View:
@{
if (!Model.Records.Any())
{
[No content found. Verify data service is available.]
return;
}
}
<ul class="record-list">
@foreach (var item in Model.Records)
{
<li> <img href="@item.Key"></img> </li>
<li> @item.Value </li>
}
</ul>