ews-cpp
0.9
|
Represents a <FileAttachment>
or an <ItemAttachment>
More...
#include <ews.hpp>
Public Types | |
enum | type { type::item, type::file } |
Describes whether an attachment contains a file or another item. More... | |
Public Member Functions | |
std::string | content () const |
Returns the attachment's contents. More... | |
std::string | content_id () const |
Returns the attachement's content ID. More... | |
size_t | content_size () const |
Returns the attachment's size in bytes. More... | |
std::string | content_type () const |
Returns the attachment's content type. | |
std::string | get_mime_content () const |
Returns the attachment's mime content. More... | |
type | get_type () const EWS_NOEXCEPT |
Returns either type::file or type::item. | |
attachment_id | id () const |
Returns this attachment's attachment_id. | |
bool | is_inline () const |
Returns true if the attachment is inlined. | |
std::string | name () const |
Returns the attachment's name. | |
std::string | to_xml () const |
Returns this attachment serialized to XML. | |
size_t | write_content_to_file (const std::string &file_path) const |
Write contents to a file. More... | |
Static Public Member Functions | |
static attachment | from_base64 (const std::string &content, std::string content_type, std::string name) |
Creates a new <FileAttachment> from a given base64 string. More... | |
static attachment | from_file (const std::string &file_path, std::string content_type, std::string name) |
Creates a new <FileAttachment> from a given file. More... | |
static attachment | from_item (const item &the_item, const std::string &name) |
Creates a new <ItemAttachment> from a given item. More... | |
static attachment | from_xml_element (const rapidxml::xml_node<> &elem) |
Constructs an attachment from a given XML element elem . | |
Represents a <FileAttachment>
or an <ItemAttachment>
|
strong |
|
inline |
Returns the attachment's contents.
If this is a <FileAttachment>
, returns the Base64-encoded contents of the file attachment. If this is an <ItemAttachment>, the empty string.
|
inline |
Returns the attachement's content ID.
If this is an inlined attachment, returns the content ID that is used to reference the attachment in the HTML code of the parent item. Otherwise returns an empty string.
|
inline |
Returns the attachment's size in bytes.
If this is a <FileAttachment>
, returns the size in bytes of the file attachment; otherwise 0.
|
inlinestatic |
Creates a new <FileAttachment>
from a given base64 string.
Returns a new <FileAttachment>
that you can pass to ews::service::create_attachment in order to create the attachment on the server.
content | Base64 content of a file |
content_type | The (RFC 2046) MIME content type of the attachment |
name | A name for this attachment |
On Windows you can use HKEY_CLASSES_ROOT/MIME/Database/Content Type registry hive to get the content type from a file extension. On a UNIX see magic(5) and file(1).
|
inlinestatic |
Creates a new <FileAttachment>
from a given file.
Returns a new <FileAttachment>
that you can pass to ews::service::create_attachment in order to create the attachment on the server.
file_path | Path to an existing and readable file |
content_type | The (RFC 2046) MIME content type of the attachment |
name | A name for this attachment |
On Windows you can use HKEY_CLASSES_ROOT/MIME/Database/Content Type registry hive to get the content type from a file extension. On a UNIX see magic(5) and file(1).
|
inlinestatic |
Creates a new <ItemAttachment>
from a given item.
It is not necessary for the item to already exist in the Exchange store. If it doesn't, it will be automatically created.
|
inline |
Returns the attachment's mime content.
If this is a <ItemAttachment>
and the mime content was requested, returns the Base64-encoded mime content of the attachment. If this is an <FileAttachment> or the mime content was not requested, returns an empty string.
|
inline |
Write contents to a file.
If this is a <FileAttachment>
, writes content to file. Does nothing if this is an <ItemAttachment>
. Returns the number of bytes written.