Class Attachment
- java.lang.Object
-
- microsoft.exchange.webservices.data.property.complex.ComplexProperty
-
- microsoft.exchange.webservices.data.property.complex.Attachment
-
- All Implemented Interfaces:
ISelfValidate,ComplexFunctionDelegate<EwsServiceXmlReader>
- Direct Known Subclasses:
FileAttachment,ItemAttachment
public abstract class Attachment extends ComplexProperty
Represents an attachment to an item.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAttachment(Item owner)Initializes a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <T> booleancanSetFieldValue(T field, T value)Sets value of field.StringgetContentId()Gets the content Id of the attachment.StringgetContentLocation()Gets the content location of the attachment.StringgetContentType()Gets the content type of the attachment.StringgetId()Gets the Id of the attachment.booleangetIsInline()Gets a value indicating whether this is an inline attachment.DategetLastModifiedTime()Gets the date and time when this attachment was last modified.StringgetName()Gets the name of the attachment.ItemgetOwner()Gets the owner of the attachment.intgetSize()Gets the size of the attachment.abstract StringgetXmlElementName()Gets the name of the XML element.protected voidinternalLoad(BodyType bodyType, Iterable<PropertyDefinitionBase> additionalProperties)Load the attachment.booleanisNew()True if the attachment has not yet been saved, false otherwise.voidload()Loads the attachment.voidsetContentId(String value)Sets the content id.voidsetContentLocation(String value)Sets the content location.voidsetContentType(String value)Sets the content type.voidsetIsInline(boolean value)Sets the checks if is inline.voidsetName(String value)Sets the name.protected voidthrowIfThisIsNotNew()Throws exception if this is not a new service object.booleantryReadElementFromXml(EwsServiceXmlReader reader)Tries to read element from XML.voidwriteElementsToXml(EwsServiceXmlWriter writer)Writes elements to XML.-
Methods inherited from class microsoft.exchange.webservices.data.property.complex.ComplexProperty
addOnChangeEvent, changed, clearChangeEvents, clearChangeLog, func, getNamespace, internalValidate, loadFromXml, loadFromXml, readAttributesFromXml, readTextValueFromXml, removeChangeEvent, setNamespace, tryReadElementFromXmlToPatch, updateFromXml, updateFromXml, validate, writeAttributesToXml, writeToXml, writeToXml
-
-
-
-
Constructor Detail
-
Attachment
protected Attachment(Item owner)
Initializes a new instance.- Parameters:
owner- The owner.
-
-
Method Detail
-
throwIfThisIsNotNew
protected void throwIfThisIsNotNew()
Throws exception if this is not a new service object.
-
canSetFieldValue
public <T> boolean canSetFieldValue(T field, T value)
Sets value of field. We override the base implementation. Attachments cannot be modified so any attempts the change a property on an existing attachment is an error.- Overrides:
canSetFieldValuein classComplexProperty- Type Parameters:
T- the generic type- Parameters:
field- The fieldvalue- The value.- Returns:
- true, if successful
-
getContentType
public String getContentType()
Gets the content type of the attachment.- Returns:
- the content type
-
setContentType
public void setContentType(String value)
Sets the content type.- Parameters:
value- the new content type
-
getContentId
public String getContentId()
Gets the content Id of the attachment. ContentId can be used as a custom way to identify an attachment in order to reference it from within the body of the item the attachment belongs to.- Returns:
- the content id
-
setContentId
public void setContentId(String value)
Sets the content id.- Parameters:
value- the new content id
-
getContentLocation
public String getContentLocation()
Gets the content location of the attachment. ContentLocation can be used to associate an attachment with a Url defining its location on the Web.- Returns:
- the content location
-
setContentLocation
public void setContentLocation(String value)
Sets the content location.- Parameters:
value- the new content location
-
getSize
public int getSize() throws ServiceVersionException
Gets the size of the attachment.- Returns:
- the size
- Throws:
ServiceVersionException- throws ServiceVersionException
-
getLastModifiedTime
public Date getLastModifiedTime() throws ServiceVersionException
Gets the date and time when this attachment was last modified.- Returns:
- the last modified time
- Throws:
ServiceVersionException- the service version exception
-
getIsInline
public boolean getIsInline() throws ServiceVersionException
Gets a value indicating whether this is an inline attachment. Inline attachments are not visible to end users.- Returns:
- the checks if is inline
- Throws:
ServiceVersionException- the service version exception
-
setIsInline
public void setIsInline(boolean value) throws ServiceVersionException
Sets the checks if is inline.- Parameters:
value- the new checks if is inline- Throws:
ServiceVersionException- the service version exception
-
isNew
public boolean isNew()
True if the attachment has not yet been saved, false otherwise.- Returns:
- true, if is new
-
getXmlElementName
public abstract String getXmlElementName()
Gets the name of the XML element.- Returns:
- XML element name.
-
tryReadElementFromXml
public boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception
Tries to read element from XML.- Overrides:
tryReadElementFromXmlin classComplexProperty- Parameters:
reader- The reader.- Returns:
- True if element was read.
- Throws:
Exception- the exception
-
writeElementsToXml
public void writeElementsToXml(EwsServiceXmlWriter writer) throws Exception
Writes elements to XML.- Overrides:
writeElementsToXmlin classComplexProperty- Parameters:
writer- the writer- Throws:
Exception- the exception
-
internalLoad
protected void internalLoad(BodyType bodyType, Iterable<PropertyDefinitionBase> additionalProperties) throws Exception
Load the attachment.- Parameters:
bodyType- Type of the body.additionalProperties- The additional property.- Throws:
Exception- the exception
-
-