2012-01-06 75 views

回答

2

sugarcrm中通常有两种“类型”的文档。添加到“文档”模块的人员以及添加到“历史记录”子面板中的人员账户模块。

要检索链接到帐户的文档,您应查看notes表。这也包含链接到帐户的历史子面板中的其他内容,例如电子邮件。如果所有文档都使用相同的document_type,则可以在document_type列上正确过滤。 (更换[account_id][session_id]

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sug="http://www.sugarcrm.com/sugarcrm" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <sug:get_entry_list soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
     <session xsi:type="xsd:string">[session_id]/session> 
     <module_name xsi:type="xsd:string">Notes</module_name> 
     <query xsi:type="xsd:string">parent_type = 'Accounts' AND parent_id = '[account_id]'</query> 
     <order_by xsi:type="xsd:string"></order_by> 
     <offset xsi:type="xsd:int">0</offset> 
     <select_fields xsi:type="sug:select_fields" soapenc:arrayType="xsd:string[1]"> 
      <select_fields xsi:type="xsd:string">id</select_fields> 
     <select_fields xsi:type="xsd:string">name</select_fields> 
      <select_fields xsi:type="xsd:string">filename</select_fields> 
      <select_fields xsi:type="xsd:string">document_revision_id</select_fields> 
     </select_fields> 
     <max_results xsi:type="xsd:int">100</max_results> 
     <deleted xsi:type="xsd:int">0</deleted> 
     </sug:get_entry_list> 
    </soapenv:Body> 
</soapenv:Envelope> 

查看该文件模块文件,你基本上做的是一样的,但它需要两个步骤。首先检索documents表中的文档,然后使用document_revision_iddocument_revisions表中检索文档idfilename

为了下载/检索文档,您需要idfilename。文件通常存储在您的sugarcrm根文件夹的/cache/upload中,并以id命名。 所以如果文件有​​3210,可以从http://my-suger/cache/upload/a06bfc2e-c6e9-ac53-9e7b-4bf4e4d862ca检索文件。检索到的文件应该重命名为filename,您可以从Web服务响应中获取该文件。

+0

我有错误这样 紫禁城 您没有权限访问/ 我给予777权限过于 – Amandeep 2012-01-06 09:23:07

+0

确保两个'upload','cache',和实际的文件是由Web服务器可读。而且,你不能在默认的SugarCRM安装中访问'http:// my-suger/cache/upload /',因为文件夹没有显示目录列表,所以你需要直接访问这些文件。 – 2012-01-06 10:58:47

+1

我正在检查www.mysite.com/cache/upload/7c960758-8109-3eb2-980f-4f06958df672有777权限的所有文件夹以及文件仍然有禁止的错误。 – Amandeep 2012-01-06 11:32:01