Results 1 to 2 of 2

Thread: [SOLVED] How to retrieve/save an attachment file in a mail with SaveDocumentRequest ?

  1. #1
    NicolasC92 is offline New Member
    Join Date
    Aug 2009
    Posts
    4
    Rep Power
    6

    Unhappy [SOLVED] How to retrieve/save an attachment file in a mail with SaveDocumentRequest ?

    Hello all

    I need to download an attachment file from a mail in SOAP with Java classes in com.zimbra.cs.zclient but I am having trouble.

    For this I've done these following steps :
    1) I get the corresponding mail with ZConversation and ZMessage
    2) I retrieve the MimePart of the mail with ZMimePart
    3) In the response of the GetMsgRequest I only have for information (concerning the attachment file(s)) : their name - size - type and the idPart of the message

    Code:
    Response : <mp s="773" filename="monFichier.xml" part="2" ct="application/xml" cd="attachment"/><mp s="86047" filename="monFichier2.jsp" part="3" ct="application/octet-stream" cd="attachment"/></mp>
    4) I have guessed that the solution is to call the SaveDocumentRequest which is detailed in ZimbraServer/doc/soap-wiki.txt (or in http://www.lahtermaher.org/pub/zimbr.../soap-wiki.txt) like this :

    Code:
    <SaveDocumentRequest>
      <doc [id="{item-id}" ver="{last-known-version}"] [name="{file-name}"] [ct="{content-type}"] [l="{folder-id}"]>
        [<upload id="{upload-id}"/>]
        [<m id="{msg-id}" part="{part-id}"/>]
      </doc>
    </SaveDocumentRequest>
    But when I do the request an error occurs :

    Here is the request I made (with the information I can fill in :
    Code:
    <SaveDocumentRequest xmlns="urn:zimbraMail"><doc name="monFichier2.jsp" l="5" ct="application/octet-stream"><m id="354" part="3"/></doc></SaveDocumentRequest>
    Here is the error message (in zimbra/log/mailbox.log) :
    Code:
    com.zimbra.common.soap.SoapFaultException: system failure: cannot create ParsedDocument
    Code:service.FAILURE
    	at com.zimbra.common.service.ServiceException.FAILURE(ServiceException.java:247)
    Is anybody know how to resolve this ?

    Thank you in advance for your help.


  2. #2
    NicolasC92 is offline New Member
    Join Date
    Aug 2009
    Posts
    4
    Rep Power
    6

    Default

    Eventually I found the answer.

    With the GET_MSG_REQUEST I get the url REST of the concerned file. For this I have set the MailConstants.A_PART and the MailConstants.A_RAW attributes.
    Then I get the content of the file (an inputstream) with this line :

    Code:
    ZMailbox.getRESTResource(urlREST);
    I hope this post may interest some of you


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 02-03-2011, 07:01 AM
  2. No email in or out
    By ValueVPS in forum Installation
    Replies: 37
    Last Post: 01-13-2010, 12:56 PM
  3. server dropped connection
    By ferra in forum Installation
    Replies: 20
    Last Post: 10-06-2008, 04:32 PM
  4. Replies: 2
    Last Post: 02-12-2008, 11:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •