microsoft.exchange.webservices.data.property.complex
Class Attachment

java.lang.Object
  extended by microsoft.exchange.webservices.data.property.complex.ComplexProperty
      extended by 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
protected Attachment(Item owner)
          Initializes a new instance.
 
Method Summary
<T> boolean
canSetFieldValue(T field, T value)
          Sets value of field.
 String getContentId()
          Gets the content Id of the attachment.
 String getContentLocation()
          Gets the content location of the attachment.
 String getContentType()
          Gets the content type of the attachment.
 String getId()
          Gets the Id of the attachment.
 boolean getIsInline()
          Gets a value indicating whether this is an inline attachment.
 Date getLastModifiedTime()
          Gets the date and time when this attachment was last modified.
 String getName()
          Gets the name of the attachment.
 Item getOwner()
          Gets the owner of the attachment.
 int getSize()
          Gets the size of the attachment.
abstract  String getXmlElementName()
          Gets the name of the XML element.
protected  void internalLoad(BodyType bodyType, Iterable<PropertyDefinitionBase> additionalProperties)
          Load the attachment.
 boolean isNew()
          True if the attachment has not yet been saved, false otherwise.
 void load()
          Loads the attachment.
 void setContentId(String value)
          Sets the content id.
 void setContentLocation(String value)
          Sets the content location.
 void setContentType(String value)
          Sets the content type.
 void setIsInline(boolean value)
          Sets the checks if is inline.
 void setName(String value)
          Sets the name.
protected  void throwIfThisIsNotNew()
          Throws exception if this is not a new service object.
 boolean tryReadElementFromXml(EwsServiceXmlReader reader)
          Tries to read element from XML.
 void writeElementsToXml(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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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:
canSetFieldValue in class ComplexProperty
Type Parameters:
T - the generic type
Parameters:
field - The field
value - The value.
Returns:
true, if successful

getId

public String getId()
Gets the Id of the attachment.

Returns:
the id

getName

public String getName()
Gets the name of the attachment.

Returns:
the name

setName

public void setName(String value)
Sets the name.

Parameters:
value - the new name

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

getOwner

public Item getOwner()
Gets the owner of the attachment.

Returns:
the owner

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:
tryReadElementFromXml in class ComplexProperty
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:
writeElementsToXml in class ComplexProperty
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

load

public void load()
          throws Exception
Loads the attachment. Calling this method results in a call to EWS.

Throws:
Exception - the exception


Copyright © 2012–2015 Microsoft. All rights reserved.