Class Attachment

    • 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
      • 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.
      • load

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