Versions Compared

Key

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

When working with metadata through the API, the recommendation is to use the API rather than working with the item directly.
The API returns a well-defined data model of type AssetMetadata which contains the following properties and methods:

Property name

Type

Stampvalue

Description

Name

String

{stampvalue-asset:name}

The title of the asset.

Description

String

{stampvalue-asset:description}

The description of the asset.

ItemIdSrting{stampvalue-asset:itemid}Sitecore item Id.

AssetId

Int

{stampvalue-asset:assetid}

This is a unique id descending from the DAM Center.

AssetTypeId

Int

{stampvalue-asset:assettypeid}

This is a unique id, representing what type the asset is. E.g. The assettype for images is 4 and the assettype for videos is 1. This id can be mapped to an item using this location:system/modules/Digizuite/[silo id]/AssetTypeRoot

AssetTypeName

String

{stampvalue-asset:assettypename}

The name of the asset type.

AssetSiloIdString{stampvalue-asset:assetsiloid}The Sitecore itemId of the silo in which the asset is located.
AssetSiloNameString{stampvalue-asset:assetsiloname}The Sitecore item name of the silo in which the asset is located.
HashSha1String{stampvalue-asset:hashsha1}The HashSha1 of the source file. Can be use to test if the fysical file of the asset has replaced.

ImportedBy

String

{stampvalue-asset:importedby}

The name of the user who uploaded the asset.

LastModified

DateTime

{stampvalue-asset:lastmodified}

The change date.

UploadDateDateTime{stampvalue-asset:uploaddate}The upload date.
FilesizeLong{stampvalue-asset:filesize}The file size of the original file in bytes.
FilesizeAbbreviatedString{stampvalue-asset:filesizeabbreviated}A more readable version of the file size ex. 606.34 KB
FileExtensionString{stampvalue-asset:fileextension}The extension of the original file.

Duration

String

{stampvalue-asset:duration}

If the asset is of type video, then this is the length of the video.

WidthInt{stampvalue-asset:width}The width of the original file.
HeightInt{stampvalue-asset:height}The height of the original file.
CropnameString{stampvalue-asset:cropname}The cropname.

DynamicMetadata

IDictionary<string, string>

{stampvalue-asset:[enter metafield guid]}

This dictionary contains all the dynamic metafields from the DAM Center. The key is the Metafield Guid. All metafields can be found either in DAM Center or in the administration section DFS 11.0 - Show Settings. Look for the property DynamicMetafields.

If you use the stampvalue, it would look like this: {stampvalue-asset:5eb3eefc-a043-410f-89b0-29ed3ef37078}

TranscodesIDictionary<string, AssetTranscode>NAA list of all transcode for the asset.
CropsList<AssetMetadata>NAA list of crops for the asset. Be aware that this property is only available from version 11.0.2.


Method name

Description

Example of return value

GetMediaUrl()

Returns the media URL for the source file.

/media/512ffeba519249ff866095d7a25846ec/1-source

GetMediaUrl(string mediaFormatId, int resizeWidth = 0, int resizeHeight = 0, bool keepAspectRatio = true, bool allowUpScale = false))Returns a media URL for the specified quality (mediaFormatId). This gives the opportunity resize the image. By default the keepAspectRatio is true and allowUpScale is false./media/512ffeba519249ff866095d7a25846ec/1-50044/resize/100x0/options/keepaspectratio

GetDownloadUrl()

Returns the download URL for the source file.

/media/512ffeba519249ff866095d7a25846ec/1-source/options/download

GetDownloadUrl(string mediaFormatId)Returns the download URL for the specified quality (mediaFormatId)./media/512ffeba519249ff866095d7a25846ec/1-50044/options/download

GetDigizuiteStreamingUrl(string mediaFormatId)

Returns a media URL for the specified quality.

/media/512ffeba519249ff866095d7a25846ec/1-50045

GetQualityName(string quality)Returns the quality name.JPG Small

...

Code Block
languagec#
linenumberstrue
AssetlistField assetList = Sitecore.Context.Item.Fields["AssetList"];
if (assetList != null)
{
	foreach (var asset in assetList.Assets)
		{
		// To request the rendering html for the asset you call the
		// RenderAsset method. It returns an RenderFieldResult object
		var renderResultItem = asset.RenderAsset(); 
		var title = asset.AssetMetadata.Name;
		var id = asset.AssetMetadata.AssetId;
		var assetTypeId = asset.AssetMetadata.AssetTypeId;
		var assetTypeName = asset.AssetMetadata.AssetTypeName; 


		// Get dynamic metadata by guid
		var someDynamicMetadata = asset.AssetMetadata["5034306e5ec7f-68c8-4bac-95ce-4f8cbea69c60"];
	}
}