/** * Gets a value indicating whether this instance has unprocessed attachment * collection changes. * * @throws ServiceLocalException */ public boolean hasUnprocessedAttachmentChanges() throws ServiceLocalException { return this.getAttachments().hasUnprocessedChanges(); }
/** * Validates this instance. * * @throws Exception the exception */ @Override public void validate() throws Exception { super.validate(); this.getAttachments().validate(); }
if (itemAttachment.getItem().getAttachments().hasUnprocessedChanges()) { return true;
.ordinal())) { ListIterator<Attachment> items = this.getAttachments().getItems() .listIterator();
this.getAttachments().validate(); this.getAttachments().save();
itemAttachment.getItem().getAttachments().save();
/** * Create item. * * @param parentFolderId the parent folder id * @param messageDisposition the message disposition * @param sendInvitationsMode the send invitations mode * @throws Exception the exception */ protected void internalCreate(FolderId parentFolderId, MessageDisposition messageDisposition, SendInvitationsMode sendInvitationsMode) throws Exception { this.throwIfThisIsNotNew(); this.throwIfThisIsAttachment(); if (this.isNew() || this.isDirty()) { this.getService().createItem( this, parentFolderId, messageDisposition, sendInvitationsMode != null ? sendInvitationsMode : this .getDefaultSendInvitationsMode()); this.getAttachments().save(); } }
/** * Gets a value indicating whether this instance has unprocessed attachment * collection changes. * * @throws ServiceLocalException */ public boolean hasUnprocessedAttachmentChanges() throws ServiceLocalException { return this.getAttachments().hasUnprocessedChanges(); }
/** * Validates this instance. * * @throws Exception the exception */ @Override public void validate() throws Exception { super.validate(); this.getAttachments().validate(); }
FolderId folderId = new FolderId(WellKnownFolderName.Inbox, "mailbox@example.com"); findResults = service.findItems(folderId, view); service.loadPropertiesForItems(findResults, new PropertySet(BasePropertySet.FirstClassProperties, EmailMessageSchema.Attachments)); for(Item item : findResults.getItems()) { if (item.getHasAttachments()) { AttachmentCollection attachmentsCol = item.getAttachments(); System.out.println(attachmentsCol.getCount()); for (int i = 0; i < attachmentsCol.getCount(); i++) { FileAttachment attachment = (FileAttachment)attachmentsCol.getPropertyAtIndex(i); attachment.load(attachment.getName()); } } }
if (item.getHasAttachments()){ AttachmentCollection attachmentsCol = item.getAttachments();
private HashMap<String,String> downloadInLineImage(Item item, String dynamicOutputDirectory) throws Exception, ServiceLocalException { //create output directory if not present //bind the item to a new email message. if you do not bind, then the getHasAttachments() function will fail EmailMessage mostRecentMatch = (EmailMessage)item; String from = mostRecentMatch.getFrom().getAddress(); String user =StringUtils.substringBefore(from, "@"); AttachmentCollection collection=item.getAttachments(); HashMap<String,String> inlineFiles=new HashMap<String,String>(); if(collection.getCount()>0) { for (Attachment attachment : collection.getItems()) { if(attachment.getIsInline()) { FileAttachment currentFile = (FileAttachment) attachment; String filePath=dynamicOutputDirectory+"/"+user+currentFile.getName(); File file=new File(filePath); FileOutputStream fio=new FileOutputStream(file); currentFile.load(fio); inlineFiles.put(currentFile.getContentId(), filePath); fio.close(); } } }
if (itemAttachment.getItem().getAttachments().hasUnprocessedChanges()) { return true;
for (Attachment att: item.getAttachments()) { attachments.add(att.getName());
.ordinal())) { ListIterator<Attachment> items = this.getAttachments().getItems() .listIterator();
itemAttachment.getItem().getAttachments().save();
this.getAttachments().validate(); this.getAttachments().save();
/** * Create item. * * @param parentFolderId the parent folder id * @param messageDisposition the message disposition * @param sendInvitationsMode the send invitations mode * @throws Exception the exception */ protected void internalCreate(FolderId parentFolderId, MessageDisposition messageDisposition, SendInvitationsMode sendInvitationsMode) throws Exception { this.throwIfThisIsNotNew(); this.throwIfThisIsAttachment(); if (this.isNew() || this.isDirty()) { this.getService().createItem( this, parentFolderId, messageDisposition, sendInvitationsMode != null ? sendInvitationsMode : this .getDefaultSendInvitationsMode()); this.getAttachments().save(); } }