<p>在任何SalesforceAPI中,一个请求最多只能获取一个附件。为了确保你没有附件附件.Id先把尸体绕一圈</p>
<pre><code>SELECT Id FROM Attachment WHERE ParentId = '...'
for ...
SELECT Body FROM Attachment WHERE Id = '...'"
</code></pre>
<p>A)<strong>SOAP</strong>API(Beatbox):将附件作为普通的长base64encoded字段获取。在</p>
^{pr2}$
<p>查询应该只有一行,因为如果存在“Body”字段,则输出限制为一行。在</p>
<p>B)如果对相同的查询使用REST</strong>API(<a href="https://github.com/simple-salesforce/simple-salesforce/" rel="nofollow noreferrer">simple-salesforce</a>包),<code>Body</code>或{<cd2>}字段的值是格式为<code>'/services/data/v40.0/sobjects/Attachment/<object_id>/Body'</code>的URL,可以通过GET请求下载。在</p>
<p>C)<a href="https://stackoverflow.com/a/46052952/448474">Fetch Salesforce Attachment content with django-salesforce</a></p>
<hr/>
<p>对二进制大对象有用的对象是附件、文档和ContentVersion。
这些有用的查询允许通过<strong>SOAP</strong>API(Beatbox)获得二进制大对象(附件或文档)作为普通的长字段。<code>ContentVersion</code>对象允许存储相同数据的更多版本。<code>Attachment</code>有父对象。<code>Document</code>没有任何父对象。有用的查询:(通过上面的API读取限制)</p>
<pre><code>SELECT Id, Body FROM Attachment WHERE ParentId = '...'
SELECT Id, Body FROM Document WHERE ParentId = '...'
SELECT Id, VersionData FROM ContentVersion WHERE ...
</code></pre>