Oracle Web Services On Demand Guide > Using Attachments with Web Services On Demand > Specifying File Attachment Content >

Attaching a File to Multiple Records


The ContentId attribute of the <Attachment> element is used to uniquely identify attachment content. The ContentID argument is optional and the Web services framework generate ones for its internal processing, if it is not provided.

The ContentID attribute allows you to reuse the content contained in another <Attachment> element so that you can specify the same attachment content for multiple records.

When reusing the content in this way, you must only specify the ContentID value, and the attachment content must be empty. Values of the ContentID attribute must be unique.

The following SOAP request shows how a file can be attached to two records:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<soap:Body>

<AccountWS_AccountInsert_Input xmlns="urn:crmondemand/ws/account/10/2004">

<ListOfAccount>

<Account>

   <Description>Account for attachment and resuse test</Description>

   <Location>Bangalore</Location>

   <AccountName>Attach Test Reuse</AccountName>

   <NumberEmployees>300</NumberEmployees>

   <ListOfAttachment>

      <Attachment>

         <FileNameOrURL>Attached</FileNameOrURL>

         <FileExtension>doc</FileExtension>

         <DisplayFileName>To be reused</DisplayFileName>

         <Attachment ContentId="reuse">0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAACAAAA+AAAAAAAAAAAEAAA+gAAAAEAAAD+////AAAAAPYAAAD3AAAA///////////////////////////

         .......... The Base64 encoded stream goes here ..........

         AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Attachment>

      </Attachment>

   </ListOfAttachment>

</Account>

<Account>

   <Description>This copying the attachment</Description>

   <Location>San Mateo</Location>

   <AccountName>Attach Test Copy</AccountName>

   <NumberEmployees>300</NumberEmployees>

   <ListOfAttachment>

      <Attachment>

         <FileNameOrURL>Attach Reuse</FileNameOrURL>

         <FileExtension>doc</FileExtension>

         <DisplayFileName>Reused</DisplayFileName>

         <Attachment ContentId="reuse"></Attachment>

      </Attachment>

   </ListOfAttachment>

</Account>

</ListOfAccount>

</AccountWS_AccountInsert_Input>

</soap:Body>

</soap:Envelope>

The SOAP request above shows how you can attach the same file to two different Account records:

  • The ContentId value Content_01 is specified for the attachment child of the first Account.
  • The same ContentId value is specified for the attachment child of the second account, with the result that the same file is attached to both accounts. You must only specify the ContentId attribute for the second account record.
Oracle Web Services On Demand Guide, Version 25.0 (Oracle CRM On Demand Release 37) Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.