public final class FileAttachment extends Attachment
Modifier | Constructor and Description |
---|---|
protected |
FileAttachment(Item owner)
Initializes a new instance.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getContent()
Gets the content of the attachment into memory.
|
protected InputStream |
getContentStream()
Gets the content stream.Gets the name of the file the attachment
is linked to.
|
String |
getFileName()
Gets the name of the file the attachment is linked to.
|
String |
getXmlElementName()
Gets the name of the XML element.
|
boolean |
isContactPhoto()
Gets a value indicating whether this attachment is a contact
photo.
|
void |
load(OutputStream stream)
Loads the content of the file attachment into the specified stream.
|
void |
load(String fileName)
Loads the content of the file attachment into the specified file.
|
protected void |
setContent(byte[] content)
Sets the content.
|
protected void |
setContentStream(InputStream contentStream)
Sets the content stream.
|
protected void |
setFileName(String fileName)
Sets the file name.
|
void |
setIsContactPhoto(boolean isContactPhoto)
Sets the checks if is contact photo.
|
boolean |
tryReadElementFromXml(EwsServiceXmlReader reader)
Tries to read element from XML.
|
boolean |
tryReadElementFromXmlToPatch(EwsServiceXmlReader reader)
For FileAttachment, the only thing need to patch is the AttachmentId.
|
protected void |
validate(int attachmentIndex)
Validates this instance.
|
void |
writeElementsToXml(EwsServiceXmlWriter writer)
Writes elements and content to XML.
|
canSetFieldValue, getContentId, getContentLocation, getContentType, getId, getIsInline, getLastModifiedTime, getName, getOwner, getSize, internalLoad, isNew, load, setContentId, setContentLocation, setContentType, setIsInline, setName, throwIfThisIsNotNew
addOnChangeEvent, changed, clearChangeEvents, clearChangeLog, func, getNamespace, internalValidate, loadFromXml, loadFromXml, readAttributesFromXml, readTextValueFromXml, removeChangeEvent, setNamespace, updateFromXml, updateFromXml, validate, writeAttributesToXml, writeToXml, writeToXml
protected FileAttachment(Item owner)
owner
- the ownerpublic String getXmlElementName()
getXmlElementName
in class Attachment
protected void validate(int attachmentIndex) throws ServiceValidationException
attachmentIndex
- Index of this attachment.ServiceValidationException
- the service validation exceptionpublic boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception
tryReadElementFromXml
in class Attachment
reader
- the readerException
- the exceptionpublic boolean tryReadElementFromXmlToPatch(EwsServiceXmlReader reader) throws Exception
tryReadElementFromXmlToPatch
in class ComplexProperty
reader
- The reader.Exception
public void writeElementsToXml(EwsServiceXmlWriter writer) throws Exception
writeElementsToXml
in class Attachment
writer
- the writerException
- the exceptionpublic void load(OutputStream stream) throws Exception
stream
- the streamException
- the exceptionpublic void load(String fileName) throws Exception
fileName
- the file nameException
- the exceptionpublic String getFileName()
protected void setFileName(String fileName)
fileName
- the new file nameprotected InputStream getContentStream()
protected void setContentStream(InputStream contentStream)
contentStream
- the new content streampublic byte[] getContent()
protected void setContent(byte[] content)
content
- the new contentpublic boolean isContactPhoto() throws ServiceVersionException
ServiceVersionException
- the service version exceptionpublic void setIsContactPhoto(boolean isContactPhoto) throws ServiceVersionException
isContactPhoto
- the new checks if is contact photoServiceVersionException
- the service version exceptionCopyright © 2012–2015 Microsoft. All rights reserved.