m.addAttribute(MailService.A_FOLDER, lc.formatItemId(doc.getFolderId()));
m.addAttribute(MailService.A_FOLDER, new ItemId(doc.getMailbox().getAccountId(), doc.getFolderId()).toString(lc));
    public static Element encodeDocumentCommon(Element m, ZimbraSoapContext lc, Document doc, int fields, int rev) {        m.addAttribute(MailService.A_ID, lc.formatItemId(doc));        if (needToOutput(fields, Change.MODIFIED_NAME)) {        	m.addAttribute(MailService.A_NAME, doc.getSubject());        	encodeRestUrl(m, doc);        }        if (needToOutput(fields, Change.MODIFIED_SIZE))            m.addAttribute(MailService.A_SIZE, doc.getSize());        if (needToOutput(fields, Change.MODIFIED_DATE))            m.addAttribute(MailService.A_DATE, doc.getDate());        if (needToOutput(fields, Change.MODIFIED_FOLDER))            m.addAttribute(MailService.A_FOLDER, lc.formatItemId(doc.getFolderId()));        recordItemTags(m, doc, fields);        if (needToOutput(fields, Change.MODIFIED_CONTENT)) {            try {                Document.DocumentRevision revision = doc.getRevision(1);                m.addAttribute(MailService.A_CREATOR, revision.getCreator());                m.addAttribute(MailService.A_CREATED_DATE, revision.getRevDate());                revision = (rev > 0) ? doc.getRevision(rev) : doc.getLastRevision();                 m.addAttribute(MailService.A_VERSION, revision.getVersion());                m.addAttribute(MailService.A_LAST_EDITED_BY, revision.getCreator());                m.addAttribute(MailService.A_MODIFIED_DATE, revision.getRevDate());                String frag = revision.getFragment();                if (frag != null && !frag.equals(""))                    m.addAttribute(MailService.E_FRAG, frag, Element.DISP_CONTENT);            } catch (Exception ex) {                mLog.warn("ignoring exception while fetching revision for document " + doc.getSubject(), ex);            }        }        return m;    }