Newer Version Available

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

StaticResource

Represents a static resource file, often a code library in a ZIP file. This metadata type extends the MetadataWithContent component and shares its fields.

Static resources allow you to upload content that you can reference in a Visualforce page, including archives (such as .zip and .jar files), images, style sheets, JavaScript, and other files.

File Suffix and Directory Location

The file suffix is .resource for the template file. The accompanying metadata file is named resource-meta.xml.

Static resource components are stored in the staticresources folder in the corresponding package directory.

Version

Static resources are available in API version 12.0 and later.

Fields

This metadata type contains the following fields:

Field Name Field Type Description
cacheControl StaticResourceCacheControl (enumeration of type string) Required. Indicates whether the static resource is marked with a public caching tag so that a third-party delivery client can cache the content. This is a new field in API version 14.0. The valid values are:
  • Private
  • Public
content base64Binary The static resource content. Base 64-encoded binary data. Prior to making an API call, client applications must encode the binary attachment data as base64. Upon receiving a response, client applications must decode the base64 data to binary. This conversion is usually handled for you by a SOAP client. This field is inherited from the MetadataWithContent component.
contentType string Required. The content type of the file, for example text/plain.
description string The description of the static resource.
fullName string The static resource name. The name can only contain characters, letters, and the underscore (_) character, must start with a letter, and cannot end with an underscore or contain two consecutive underscore characters.

Inherited from the Metadata component, this field is not defined in the WSDL for this component. It must be specified when creating, updating, or deleting. See create() to see an example of this field specified for a call.

Declarative Metadata Sample Definition

1<?xml version="1.0" encoding="UTF-8"?>
2<StaticResource xmlns="http://soap.sforce.com/2006/04/metadata">
3    <contentType>text/plain</contentType>
4    <description>Test Resource</description>
5</StaticResource>