/** * Initializes a new instance of the class. * * @param referenceItem the reference item * @throws Exception the exception */ public PostReply(Item referenceItem) throws Exception { super(referenceItem.getService()); referenceItem.throwIfThisIsNew(); this.referenceItem = referenceItem; }
/** * Initializes a new instance of the class. * * @param referenceItem the reference item * @throws Exception the exception */ public SuppressReadReceipt(Item referenceItem) throws Exception { super(referenceItem.getService()); referenceItem.throwIfThisIsNew(); this.referenceItem = referenceItem; }
/** * Initializes a new instance of the item class. * * @param parentAttachment The parent attachment. * @throws Exception the exception */ public Item(final ItemAttachment parentAttachment) throws Exception { this(parentAttachment.getOwner().getService()); this.parentAttachment = parentAttachment; }
/** * Initializes a new instance of the RemoveFromCalendar class. * * @param referenceItem The reference item * @throws Exception the exception */ public RemoveFromCalendar(Item referenceItem) throws Exception { super(referenceItem.getService()); referenceItem.throwIfThisIsNew(); this.referenceItem = referenceItem; }
/** * Initializes a new instance of the class. * * @param referenceItem the reference item * @throws Exception the exception */ protected ResponseObject(Item referenceItem) throws Exception { super(referenceItem.getService()); referenceItem.throwIfThisIsNew(); this.referenceItem = referenceItem; }
/** * Gets the size of the attachment. * * @return the size * @throws ServiceVersionException throws ServiceVersionException */ public int getSize() throws ServiceVersionException { EwsUtilities.validatePropertyVersion(this.getOwner().getService(), ExchangeVersion.Exchange2010, "Size"); return this.size; }
/** * Gets a value indicating whether this attachment is a contact * photo. * * @return true, if is contact photo * @throws ServiceVersionException the service version exception */ public boolean isContactPhoto() throws ServiceVersionException { EwsUtilities.validatePropertyVersion(this.getOwner().getService(), ExchangeVersion.Exchange2010, "IsContactPhoto"); return this.isContactPhoto; }
/** * Gets the date and time when this attachment was last modified. * * @return the last modified time * @throws ServiceVersionException the service version exception */ public Date getLastModifiedTime() throws ServiceVersionException { EwsUtilities.validatePropertyVersion(this.getOwner().getService(), ExchangeVersion.Exchange2010, "LastModifiedTime"); return this.lastModifiedTime; }
/** * Gets a value indicating whether this is an inline attachment. * Inline attachments are not visible to end users. * * @return the checks if is inline * @throws ServiceVersionException the service version exception */ public boolean getIsInline() throws ServiceVersionException { EwsUtilities.validatePropertyVersion(this.getOwner().getService(), ExchangeVersion.Exchange2010, "IsInline"); return this.isInline; }
/** * Load the attachment. * * @param bodyType Type of the body. * @param additionalProperties The additional property. * @throws Exception the exception */ protected void internalLoad(BodyType bodyType, Iterable<PropertyDefinitionBase> additionalProperties) throws Exception { this.getOwner().getService().getAttachment(this, bodyType, additionalProperties); }
/** * The property definition for the Id of this object. * * @param propertySet the property set * @throws Exception the exception */ @Override protected void internalLoad(PropertySet propertySet) throws Exception { this.throwIfThisIsNew(); this.throwIfThisIsAttachment(); ArrayList<Item> itemArry = new ArrayList<Item>(); itemArry.add(this); this.getService().internalLoadPropertiesForItems(itemArry, propertySet, ServiceErrorHandling.ThrowOnError); }
/** * Sets the checks if is contact photo. * * @param isContactPhoto the new checks if is contact photo * @throws ServiceVersionException the service version exception */ public void setIsContactPhoto(boolean isContactPhoto) throws ServiceVersionException { EwsUtilities.validatePropertyVersion(this.getOwner().getService(), ExchangeVersion.Exchange2010, "IsContactPhoto"); this.throwIfThisIsNotNew(); this.isContactPhoto = isContactPhoto; }
/** * Sets the checks if is inline. * * @param value the new checks if is inline * @throws ServiceVersionException the service version exception */ public void setIsInline(boolean value) throws ServiceVersionException { EwsUtilities.validatePropertyVersion(this.getOwner().getService(), ExchangeVersion.Exchange2010, "IsInline"); if (this.canSetFieldValue(this.isInline, value)) { this.isInline = value; this.changed(); } }
/** * Creates a copy of this item in the specified folder. Calling this method * results in a call to EWS. Copy returns null if the copy operation is * across two mailboxes or between a mailbox and a public folder. * * @param destinationFolderId the destination folder id * @return The copy of this item. * @throws Exception the exception */ public Item copy(FolderId destinationFolderId) throws Exception { this.throwIfThisIsNew(); this.throwIfThisIsAttachment(); EwsUtilities.validateParam(destinationFolderId, "destinationFolderId"); return this.getService().copyItem(this.getId(), destinationFolderId); }
/** * Moves this item to a the specified folder. Calling this method results in * a call to EWS. Move returns null if the move operation is across two * mailboxes or between a mailbox and a public folder. * * @param destinationFolderId the destination folder id * @return The moved copy of this item. * @throws Exception the exception */ public Item move(FolderId destinationFolderId) throws Exception { this.throwIfThisIsNew(); this.throwIfThisIsAttachment(); EwsUtilities.validateParam(destinationFolderId, "destinationFolderId"); return this.getService().moveItem(this.getId(), destinationFolderId); }
/** * Calls the DeleteAttachment web method to delete a list of attachments. * * @param attachments the attachments * @throws Exception the exception */ private void internalDeleteAttachments(Iterable<Attachment> attachments) throws Exception { ServiceResponseCollection<DeleteAttachmentResponse> responses = this.owner .getService().deleteAttachments(attachments); Enumeration<DeleteAttachmentResponse> enumerator = responses .getEnumerator(); while (enumerator.hasMoreElements()) { DeleteAttachmentResponse response = enumerator.nextElement(); // We remove all attachments that were successfully deleted from the // change log. We should never // receive a warning from EWS, so we ignore them. if (response.getResult() != ServiceResult.Error) { this.removeFromChangeLog(response.getAttachment()); } } // TODO : Should we throw for warnings as well? if (responses.getOverallResult() == ServiceResult.Error) { throw new DeleteAttachmentException(responses, "At least one attachment couldn't be deleted."); } }
/** * Calls the CreateAttachment web method to create a list of attachments. * * @param parentItemId the parent item id * @param attachments the attachments * @throws Exception the exception */ private void internalCreateAttachments(String parentItemId, Iterable<Attachment> attachments) throws Exception { ServiceResponseCollection<CreateAttachmentResponse> responses = this.owner .getService().createAttachments(parentItemId, attachments); Enumeration<CreateAttachmentResponse> enumerator = responses .getEnumerator(); while (enumerator.hasMoreElements()) { CreateAttachmentResponse response = enumerator.nextElement(); // We remove all attachments that were successfully created from the // change log. We should never // receive a warning from EWS, so we ignore them. if (response.getResult() != ServiceResult.Error) { this.removeFromChangeLog(response.getAttachment()); } } // TODO : Should we throw for warnings as well? if (responses.getOverallResult() == ServiceResult.Error) { throw new CreateAttachmentException(responses, "At least one attachment couldn't be created."); } }
/** * Deletes the object. * * @param deleteMode the delete mode * @param sendCancellationsMode the send cancellations mode * @param affectedTaskOccurrences the affected task occurrences * @throws ServiceLocalException the service local exception * @throws Exception the exception */ @Override protected void internalDelete(DeleteMode deleteMode, SendCancellationsMode sendCancellationsMode, AffectedTaskOccurrence affectedTaskOccurrences) throws ServiceLocalException, Exception { this.throwIfThisIsNew(); this.throwIfThisIsAttachment(); // If sendCancellationsMode is null, use the default value that's // appropriate for item type. if (sendCancellationsMode == null) { sendCancellationsMode = this.getDefaultSendCancellationsMode(); } // If affectedTaskOccurrences is null, use the default value that's // appropriate for item type. if (affectedTaskOccurrences == null) { affectedTaskOccurrences = this.getDefaultAffectedTaskOccurrences(); } this.getService().deleteItem(this.getId(), deleteMode, sendCancellationsMode, affectedTaskOccurrences); }
/** * 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(); } }
.getService() .updateItem( this,