Thanks Michael, but I'd like to retrieve a url link to the attached file if it's possible.

Thanks anyway.

Santy, Michael escribió:

Hello,

I had to do something similar. Below is the code that I used to retrieve an attachment given its filename:

protected Blob retrieveAttachment(DocumentModel dm, String filename) {
   Blob rv = null;

   List<Map<String, Object>> files = (List<Map<String, Object>>) dm
      .getProperty("files", "files");
   for (Map<String, Object> fileProperties : files) {
      if (filename.equals(fileProperties.get("filename"))) {
         rv = (Blob) fileProperties.get("file");
      }
   }
   return rv;
}

If anyone has a simpler way to do this, I'm listening.

Cheers,
Mike


-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Enrique Perez
Sent: Thu 4/10/2008 10:31 AM
To: ECM List
Subject: [SPAM]  [Ecm] How can I retrieve attached files?

Hi all,

I'm developping a portlet that browse the content of a folder (or
workspace) and retrieve the documents. I can get the information of the
files with the export restlet, but I don't know how can I retrieve
attached files.

If the document type is File I can retrieve it with the url:
nuxeo/nxfile/{repository}/{docid}/file:content/{filename}, but if the
file is attached to another type of document (for example: a image file
attached to a Note document) I can't retrieve it using this url.

I also try with the downloadRestlet restlet but I have the same result:
it only works with the File documents.

How can I retrieve these files?

Thanks in advance.

--
Enrique Pérez Olivares.
Dpto I+D.
Yerbabuena Software.
[EMAIL PROTECTED]
http://www.yerbabuena.es
Tlf/Fax: 902 995 246


_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm



--
Enrique Pérez Olivares.
Dpto I+D.
Yerbabuena Software.
[EMAIL PROTECTED]
http://www.yerbabuena.es
Tlf/Fax: 902 995 246
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm

Reply via email to