Newer Version Available

This content describes an older version of this product. View Latest

ContentAsset

Represents the metadata for creating an asset file. Asset files enable a Salesforce file to be used for org setup and configuration purposes. This type extends the MetadataWithContent metadata type and inherits its content and fullName fields.

File Suffix and Directory Location

ContentAsset components have the suffix .asset and are stored in the contentassets folder.

Version

ContentAsset components are available in API version 38.0 and later.

Special Access Rules

The system prevents metadata retrieval if the total size of the asset’s file content exceeds 30 MB. All pre-existing limits for packaging apply to asset files.

Fields

Field Name Field Type Description
format ContentAssetFormat (enumeration of type string) Describes the format of the asset file. Valid values are:
  • Original—A single asset file version.
  • ZippedVersions—Contains multiple versions of the asset file.
isVisibleByExternalUsers boolean Indicates whether unauthenticated users can see the asset file (true) or not (false). If not specified, the default value is false. This field is available in API version 44.0 and later.
language string Required. The language of the asset file label.
masterLabel string Required. The label for the asset file record, which displays in Setup.
originNetwork string For deploys, the name of the community the file is assigned upon creation. For retrievals, the name of the community the file is assigned to populates the field value. If null, file was not assigned to a community.
relationships ContentAsset​Relationships[] The list of ContentAssetLinks that describe whether the asset file should be shared with the org.
versions ContentAssetVersions Required. Captures basic information about the file version(s) included the asset metadata. Typically the file has only one version.

ContentAsset​Relationships

Represents the relationships between an asset file and the locations it's linked with.

Field Name Field Type Description
organization ContentAssetLink[] Carries information about sharing the asset file with the org. Maps to ContentDocumentLink.

ContentAssetLink

Represents a relationship link for an asset file, and includes details about the level of access for the link.

Field Name Field Type Description
access ContentAssetAccess (enumeration of type string) Required. The permission granted to the user of the shared file, determined by the permission the user already has. Valid values are:
  • VIEWER
  • COLLABORATOR
  • INFERRED
name string Reserved for future use.

ContentAssetVersions

Represents information about all file versions included in the asset metadata.

Field Name Field Type Description
version ContentAssetVersion[] A list of file versions for the asset.

ContentAssetVersion

Represents information about one file version included in the asset metadata.

Field Name Field Type Description
number string Required. The version number. This field is based on, or sets, the ContentVersion.
pathOnClient string Required. Describes the original filename of the file. This field maps to ContentVersion.PathOnClient. It provides the data for the ContentVersion Title field.
zipEntry string If the asset file has more than one version, format is ZippedVersions. In this case, zipEntry is the name of the file within the zip. If the asset file has only one version, this field is empty.

Declarative Metadata Sample Definition

The following is an example of a ContentAsset component.

1<?xml version="1.0" encoding="UTF-8"?>
2<ContentAsset xmlns="http://soap.sforce.com/2006/04/metadata">
3    <masterLabel>some asset</masterLabel>
4    <relationships>
5        <organization>
6            <access>VIEWER</access>
7        </organization>
8    </relationships>
9    <versions>
10        <version>
11            <number>1</number>
12            <pathOnClient>some asset.txt</pathOnClient>
13        </version>
14    </versions>
15</ContentAsset>

For assets that include just one version, the format field can be omitted or specified with the value as Original. File assets with more than one version have versions wrapped in a zip file.

The following is an example package.xml that references the previous definition.

1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3    <types>
4        <members>MyAsset</members>
5        <name>ContentAsset</name>
6    </types>
7    <version>47.0</version>
8</Package>

Wildcard Support in the Manifest File

This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.