Class representing an attachment in Outlook.
An R6 object of class ms_outlook_attachment
, inheriting from ms_outlook_object
, which in turn inherits from ms_object
.
token
: The token used to authenticate with the Graph host.
tenant
: The Azure Active Directory tenant for the email account.
type
: always "attachment" for an attachment.
properties
: The attachment properties (metadata).
new(...)
: Initialize a new object. Do not call this directly; see 'Initialization' below.
delete(confirm=TRUE)
: Delete this attachment. By default, ask for confirmation first.
update(...)
: Update the attachment's properties (metadata) in Microsoft Graph.
do_operation(...)
: Carry out an arbitrary operation on the attachment.
sync_fields()
: Synchronise the R object with the attachment metadata in Microsoft Graph. This method does not transfer the attachment content for a file attachment.
download(dest, overwrite)
: For a file attachment, downloads the content to a file. The default destination filename is the name of the attachment.
Creating new objects of this class should be done via the the get_attachment()
, list_attachments()
or create_attachment()
methods ms_outlook_email
class. Calling the new()
method for this class only constructs the R object; it does not call the Microsoft Graph API to retrieve or create the actual attachment.
In general, you should not need to interact directly with this class, as the ms_outlook_email
class exposes convenience methods for working with attachments. The only exception is to download an attachment in a reliable way (not involving the attachment name); see the example below.
if (FALSE) {
outl <- get_personal_outlook()
em <- outl$get_inbox$get_email("email_id")
# download the first attachment in an email
atts <- em$list_attachments()
atts[[1]]$download()
}