Activity Forums Salesforce® Discussions Can I Insert a Static Resource using Apex Code in Salesforce? Reply To: Can I Insert a Static Resource using Apex Code in Salesforce?

  • Abhinav

    Member
    April 14, 2016 at 8:35 am

    But looks like we can insert the static resource through API. Because static resource is present in the metadata WSDL. So, i guess we can insert from API.

    Below are 2 static resources classes :-

    <xsd:complexType name="StaticResource">
    <xsd:complexContent>
    <xsd:extension base="tns:MetadataWithContent">
    <xsd:sequence>
    <xsd:element name="cacheControl" type="tns:StaticResourceCacheControl"/>
    <xsd:element name="contentType" type="xsd:string"/>
    <xsd:element name="description" minOccurs="0" type="xsd:string"/>
    </xsd:sequence>
    </xsd:extension>

     

    </xsd:complexContent>
    </xsd:complexType>
    <xsd:simpleType name="StaticResourceCacheControl">
    <xsd:restriction base="xsd:string">
    <xsd:enumeration value="Private"/>
    <xsd:enumeration value="Public"/>
    </xsd:restriction>
    </xsd:simpleType>