Show / Hide Table of Contents

Class EMailAgent

Proxy class for the EMail Agent Used when communicating remote using WebServices. Avoid using directly. Use the AgentFactory to create the proxy instead.

Online Restricted: This agent is not available in Online by default. Access must be requested specifically when app is registered.

Inheritance
object
EMailAgent
Implements
IEMailAgent
IAgent
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOfficeCRMServices
Assembly: SuperOffice.Services.Implementation.dll
Syntax
public class EMailAgent : IEMailAgent, IAgent

Constructors

EMailAgent(IEMailAccountImplementation, IEMailAddressImplementation, IEMailAppointmentImplementation, IEMailAttachmentImplementation, IEMailConnectionInfoImplementation, IEMailConnectionInfoExtendedImplementation, IEMailCustomHeaderImplementation, IEMailEntityImplementation, IEMailEnvelopeImplementation, IEMailFolderImplementation, IEMailSOInfoImplementation, ISyncUserAccountImplementation, ISoRequestItemsAccessor)

Declaration
public EMailAgent(IEMailAccountImplementation eMailAccountImplementation, IEMailAddressImplementation eMailAddressImplementation, IEMailAppointmentImplementation eMailAppointmentImplementation, IEMailAttachmentImplementation eMailAttachmentImplementation, IEMailConnectionInfoImplementation eMailConnectionInfoImplementation, IEMailConnectionInfoExtendedImplementation eMailConnectionInfoExtendedImplementation, IEMailCustomHeaderImplementation eMailCustomHeaderImplementation, IEMailEntityImplementation eMailEntityImplementation, IEMailEnvelopeImplementation eMailEnvelopeImplementation, IEMailFolderImplementation eMailFolderImplementation, IEMailSOInfoImplementation eMailSOInfoImplementation, ISyncUserAccountImplementation syncUserAccountImplementation, ISoRequestItemsAccessor accessor)
Parameters
Type Name Description
IEMailAccountImplementation eMailAccountImplementation
IEMailAddressImplementation eMailAddressImplementation
IEMailAppointmentImplementation eMailAppointmentImplementation
IEMailAttachmentImplementation eMailAttachmentImplementation
IEMailConnectionInfoImplementation eMailConnectionInfoImplementation
IEMailConnectionInfoExtendedImplementation eMailConnectionInfoExtendedImplementation
IEMailCustomHeaderImplementation eMailCustomHeaderImplementation
IEMailEntityImplementation eMailEntityImplementation
IEMailEnvelopeImplementation eMailEnvelopeImplementation
IEMailFolderImplementation eMailFolderImplementation
IEMailSOInfoImplementation eMailSOInfoImplementation
ISyncUserAccountImplementation syncUserAccountImplementation
SuperOffice.Factory.ISoRequestItemsAccessor accessor

EMailAgent(IEMailAccountImplementation, IEMailAddressImplementation, IEMailAppointmentImplementation, IEMailAttachmentImplementation, IEMailConnectionInfoImplementation, IEMailConnectionInfoExtendedImplementation, IEMailCustomHeaderImplementation, IEMailEntityImplementation, IEMailEnvelopeImplementation, IEMailFolderImplementation, IEMailSOInfoImplementation, ISyncUserAccountImplementation, ISoRequestItemsAccessor, IDebugUser, IServiceCallsRepository, IScriptingConfiguration, IOnlineConfiguration)

Declaration
public EMailAgent(IEMailAccountImplementation eMailAccountImplementation, IEMailAddressImplementation eMailAddressImplementation, IEMailAppointmentImplementation eMailAppointmentImplementation, IEMailAttachmentImplementation eMailAttachmentImplementation, IEMailConnectionInfoImplementation eMailConnectionInfoImplementation, IEMailConnectionInfoExtendedImplementation eMailConnectionInfoExtendedImplementation, IEMailCustomHeaderImplementation eMailCustomHeaderImplementation, IEMailEntityImplementation eMailEntityImplementation, IEMailEnvelopeImplementation eMailEnvelopeImplementation, IEMailFolderImplementation eMailFolderImplementation, IEMailSOInfoImplementation eMailSOInfoImplementation, ISyncUserAccountImplementation syncUserAccountImplementation, ISoRequestItemsAccessor accessor, IDebugUser debugUser, IServiceCallsRepository serviceCallsRepository, ConfigFile.IScriptingConfiguration scriptingConfiguration, ConfigFile.IOnlineConfiguration onlineConfiguration)
Parameters
Type Name Description
IEMailAccountImplementation eMailAccountImplementation
IEMailAddressImplementation eMailAddressImplementation
IEMailAppointmentImplementation eMailAppointmentImplementation
IEMailAttachmentImplementation eMailAttachmentImplementation
IEMailConnectionInfoImplementation eMailConnectionInfoImplementation
IEMailConnectionInfoExtendedImplementation eMailConnectionInfoExtendedImplementation
IEMailCustomHeaderImplementation eMailCustomHeaderImplementation
IEMailEntityImplementation eMailEntityImplementation
IEMailEnvelopeImplementation eMailEnvelopeImplementation
IEMailFolderImplementation eMailFolderImplementation
IEMailSOInfoImplementation eMailSOInfoImplementation
ISyncUserAccountImplementation syncUserAccountImplementation
SuperOffice.Factory.ISoRequestItemsAccessor accessor
SuperOffice.Data.IDebugUser debugUser
SuperOffice.Diagnostics.IServiceCallsRepository serviceCallsRepository
SuperOffice.Configuration.ConfigFile.IScriptingConfiguration scriptingConfiguration
SuperOffice.Configuration.ConfigFile.IOnlineConfiguration onlineConfiguration

Methods

AuthenticateAsync(EMailConnectionInfoExtended, CancellationToken)

Declaration
public Task<bool> AuthenticateAsync(EMailConnectionInfoExtended connectionInfoExtended, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfoExtended connectionInfoExtended
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskbool

AuthenticateIncomingAsync(EMailConnectionInfo, CancellationToken)

Authenticate against a mail-server to retrieve e-mails from

Declaration
public Task<bool> AuthenticateIncomingAsync(EMailConnectionInfo connectionInfo, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskbool

True if authentication was succcesfull

AuthenticateOutgoingAsync(EMailConnectionInfo, CancellationToken)

Authenticate against a mail server to send items with

Declaration
public Task<bool> AuthenticateOutgoingAsync(EMailConnectionInfo connectionInfo, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskbool

True if authentication was succcesfull

CacheFolderListAsync(CancellationToken)

Fetch list of folders from email server for the current account, and cache in DB

Declaration
public Task<EMailFolder[]> CacheFolderListAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailFolder

List of folders from mail server

CreateDefaultEMailAccountAsync(CancellationToken)

Loading default values into a new EMailAccount.

Declaration
public Task<EMailAccount> CreateDefaultEMailAccountAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAccount

New EMailAccount with default values

CreateDefaultEMailAddressAsync(CancellationToken)

Loading default values into a new EMailAddress.

Declaration
public Task<EMailAddress> CreateDefaultEMailAddressAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAddress

New EMailAddress with default values

CreateDefaultEMailAppointmentAsync(CancellationToken)

Loading default values into a new EMailAppointment.

Declaration
public Task<EMailAppointment> CreateDefaultEMailAppointmentAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAppointment

New EMailAppointment with default values

CreateDefaultEMailAttachmentAsync(CancellationToken)

Loading default values into a new EMailAttachment.

Declaration
public Task<EMailAttachment> CreateDefaultEMailAttachmentAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAttachment

New EMailAttachment with default values

CreateDefaultEMailConnectionInfoAsync(CancellationToken)

Loading default values into a new EMailConnectionInfo.

Declaration
public Task<EMailConnectionInfo> CreateDefaultEMailConnectionInfoAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailConnectionInfo

New EMailConnectionInfo with default values

CreateDefaultEMailConnectionInfoExtendedAsync(CancellationToken)

Loading default values into a new EMailConnectionInfoExtended.

Declaration
public Task<EMailConnectionInfoExtended> CreateDefaultEMailConnectionInfoExtendedAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailConnectionInfoExtended

New EMailConnectionInfoExtended with default values

CreateDefaultEMailCustomHeaderAsync(CancellationToken)

Loading default values into a new EMailCustomHeader.

Declaration
public Task<EMailCustomHeader> CreateDefaultEMailCustomHeaderAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailCustomHeader

New EMailCustomHeader with default values

CreateDefaultEMailEntityAsync(CancellationToken)

Loading default values into a new EMailEntity.

Declaration
public Task<EMailEntity> CreateDefaultEMailEntityAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

New EMailEntity with default values

CreateDefaultEMailEnvelopeAsync(CancellationToken)

Loading default values into a new EMailEnvelope.

Declaration
public Task<EMailEnvelope> CreateDefaultEMailEnvelopeAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEnvelope

New EMailEnvelope with default values

CreateDefaultEMailFolderAsync(CancellationToken)

Loading default values into a new EMailFolder.

Declaration
public Task<EMailFolder> CreateDefaultEMailFolderAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailFolder

New EMailFolder with default values

CreateDefaultEMailSOInfoAsync(CancellationToken)

Loading default values into a new EMailSOInfo.

Declaration
public Task<EMailSOInfo> CreateDefaultEMailSOInfoAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailSOInfo

New EMailSOInfo with default values

CreateEMailFromDocumentEntityAsync(DocumentEntity, CancellationToken)

Get an e-mail based on the provided DocumentEntity

Declaration
public Task<EMailEntity> CreateEMailFromDocumentEntityAsync(DocumentEntity documentEntity, CancellationToken cancellationToken = default)
Parameters
Type Name Description
DocumentEntity documentEntity

DocumentEntity data

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The e-mail

CreateEMailFromMimeMessageAsync(string, CancellationToken)

Get an e-mail based on the provided MIME-message

Declaration
public Task<EMailEntity> CreateEMailFromMimeMessageAsync(string mimeMessage, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string mimeMessage

string representing a MIME-formatted message

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The e-mail

CreateFolderAsync(EMailConnectionInfo, CancellationToken)

Create a new folder on the server

Declaration
public Task CreateFolderAsync(EMailConnectionInfo connectionInfo, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

CreateForwardEmailAsync(EMailEntity, CancellationToken)

Create forward email

Declaration
public Task<EMailEntity> CreateForwardEmailAsync(EMailEntity email, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailEntity email

The e-mail to forward

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The new forward email entity

CreateInlineHtmlHeaderAsync(EMailEntity, CancellationToken)

Create Outlook style HTML header to use in for instance reply entities and when printing

Declaration
public Task<string> CreateInlineHtmlHeaderAsync(EMailEntity email, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailEntity email

The e-mail to generate header based on

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskstring

The generated HTML header

CreateNewPhysicalDocumentFromEmailAsync(int, int, CancellationToken)

Save the Email from the server as a document file connected to existing document

Declaration
public Task<DocumentEntity> CreateNewPhysicalDocumentFromEmailAsync(int documentId, int emailItemId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int documentId

The document ID int the DB

int emailItemId

The emails ID in the DB

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskDocumentEntity

The document

CreateNewPhysicalDocumentFromEmailAttachmentAsync(int, int, string, CancellationToken)

Save the Email from the server as a document file connected to existing document

Declaration
public Task<DocumentEntity> CreateNewPhysicalDocumentFromEmailAttachmentAsync(int documentId, int emailItemId, string attachmentId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int documentId

The document ID int the DB

int emailItemId

The emails ID int the DB

string attachmentId

Id string of the attachment

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskDocumentEntity

The document

DeleteAsync(EMailConnectionInfo, int[], string, CancellationToken)

Delete specified mail items

Declaration
public Task DeleteAsync(EMailConnectionInfo connectionInfo, int[] messageServerIds, string moveToFolder, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

int messageServerIds

The e-mails to handle

string moveToFolder

If set, move deleted items to this folder

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

DeleteEMailAccountAsync(int, CancellationToken)

Deletes the EMailAccount

Declaration
public Task DeleteEMailAccountAsync(int eMailAccountId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int eMailAccountId

The identity of the EMailAccount

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

This method has no return value

DeleteEmailsAsync(int[], string, CancellationToken)

Delete specified mail items and optionally move to the specified folder

Declaration
public Task DeleteEmailsAsync(int[] ids, string moveToFolder, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int ids

The e-mails to handle

string moveToFolder

If set, move deleted items to this folder

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

DeleteExtendedAsync(EMailConnectionInfoExtended, string[], CancellationToken)

Declaration
public Task DeleteExtendedAsync(EMailConnectionInfoExtended connectionInfoExtended, string[] messageIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfoExtended connectionInfoExtended
string messageIds
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

DeleteFolderAsync(EMailConnectionInfo, CancellationToken)

Delete a folder from the server

Declaration
public Task DeleteFolderAsync(EMailConnectionInfo connectionInfo, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

EmptyFolderAsync(EMailConnectionInfo, string, CancellationToken)

Delete all items in folder specified in the connection object

Declaration
public Task EmptyFolderAsync(EMailConnectionInfo connectionInfo, string moveToFolder, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

string moveToFolder

If set, move deleted items to this folder

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

FindAddressAsync(string, CancellationToken)

Search for contacts and persons with the specified e-mail address (exact match on the email address string required)

Declaration
public Task<EMailAddress[]> FindAddressAsync(string address, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string address

E-mail address to look for

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAddress

All resolved contacts/persons

FindContactOrPersonByEmailNameAsync(string, string, CancellationToken)

Declaration
public Task<ContactOrPersonFromEmail[]> FindContactOrPersonByEmailNameAsync(string name, string emailAddress, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string name

The sender name

string emailAddress

The sender email address

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskContactOrPersonFromEmail

Contacts and persons matching emailaddress and name

FindContactOrPersonByEmailNameWithLimitAsync(string, string, int, int, CancellationToken)

Declaration
public Task<ContactOrPersonFromEmail[]> FindContactOrPersonByEmailNameWithLimitAsync(string name, string emailAddress, int numberOfContacts, int numberOfPersons, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string name

The sender name

string emailAddress

The sender email address

int numberOfContacts

Maximum returned number of contacts

int numberOfPersons

Maximum returned number of persons

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskContactOrPersonFromEmail

Contacts and persons matching emailaddress and name

GetAttachmentAsync(EMailConnectionInfo, int, string, CancellationToken)

Retrieve an attachment from an e-mail

Declaration
public Task<EMailAttachment> GetAttachmentAsync(EMailConnectionInfo connectionInfo, int messageServerId, string attachmentId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

int messageServerId

Unique ID for the e-mail to retrieve the attachment from

string attachmentId

Id of the attachment in the e-mail

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAttachment

The attachment

GetAttachmentFromIdAsync(int, string, CancellationToken)

Retrieve an attachment from an e-mail

Declaration
public Task<EMailAttachment> GetAttachmentFromIdAsync(int mailItemId, string attachmentId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int mailItemId

Unique ID for the e-mail to retrieve the attachment from

string attachmentId

Id of the attachment in the e-mail

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAttachment

The attachment

GetCurrentAccountAsync(CancellationToken)

Get current account (last logged into should normally be current) for logged in associate

Declaration
public Task<EMailAccount> GetCurrentAccountAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAccount

Id of current account

GetCurrentAccountIdAsync(CancellationToken)

Get current accountId (last logged into should normally be current) for logged in associate

Declaration
public Task<int> GetCurrentAccountIdAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskint

Id of current account

GetEMailAccountAsync(int, CancellationToken)

Gets a EMailAccount object.

Declaration
public Task<EMailAccount> GetEMailAccountAsync(int eMailAccountId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int eMailAccountId

The identifier of the EMailAccount object

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAccount

A single EMailAccount

GetEMailAccountFromEMailAddressAsync(string, CancellationToken)

Returns the email account corresponding to this email address (for the current associate).

Declaration
public Task<EMailAccount> GetEMailAccountFromEMailAddressAsync(string fromAddress, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string fromAddress

The address associated with this email account

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAccount

Found or empty email account

GetEMailAddressesAsync(int[], CancellationToken)

Get information about one or more email addresses, identified by IDs

Declaration
public Task<EMailAddress[]> GetEMailAddressesAsync(int[] emailIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int emailIds

Array of IDs from the email table, each identifying one email address

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAddress

Array of email information objects

GetEMailAsStreamAsync(EMailConnectionInfo, int, bool, CancellationToken)

Retrieve an e-mail optionally stripping attachments as a stream

Declaration
public Task<Stream> GetEMailAsStreamAsync(EMailConnectionInfo connectionInfo, int messageServerId, bool stripAttachments, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

int messageServerId

Unique ID for the e-mail to retrieve

bool stripAttachments

If true, do not include attachments in stream

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskStream

The attachment as a stream

GetEMailAsync(int, bool, CancellationToken)

Get en e-mail based on its primary key in the DB

Declaration
public Task<EMailEntity> GetEMailAsync(int id, bool includeAttachments, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int id

The primary key of the email row in the DB

bool includeAttachments

Should we retrieve attachments embedded in the e-mail from the server

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The e-mail

GetEMailEnvelopesAsync(EMailConnectionInfo, int[], CancellationToken)

Retrieve a set of e-mail envelopes

Declaration
public Task<EMailEnvelope[]> GetEMailEnvelopesAsync(EMailConnectionInfo connectionInfo, int[] messageServerIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

int messageServerIds

Unique identitifiers for the e-mails to retrieve envelopes for

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEnvelope

The e-mail envelope objects

GetEMailFromAttachmentIdAsync(int, string[], bool, CancellationToken)

Get an e-mail based on an email and attachment id

Declaration
public Task<EMailEntity> GetEMailFromAttachmentIdAsync(int emailId, string[] attachmentIds, bool includeAttachments, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int emailId

The primary key of the email row in the DB

string attachmentIds

Id of the attachment. If multiple elements this is treated as attachment in attachemnts, e.g. [1, 2] means attachment 2 in attachment 1 of email.

bool includeAttachments

Should we retrieve attachments embedded in the e-mail from the server

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The attachment as an e-mail

GetEMailFromDocumentAttachmentIdAsync(int, string[], bool, CancellationToken)

Get an e-mail based on an email in the archive system and attachment id

Declaration
public Task<EMailEntity> GetEMailFromDocumentAttachmentIdAsync(int docId, string[] attachmentIds, bool includeAttachments, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int docId

The primary key of the document row in the DB

string attachmentIds

Id of the attachment. If multiple elements this is treated as attachment in attachemnts, e.g. [1, 2] means attachment 2 in attachment 1 of email.

bool includeAttachments

Should we retrieve attachments embedded in the e-mail from the server

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The attachment as an e-mail

GetEMailFromDocumentIdAsync(int, CancellationToken)

Get an e-mail based on an archived document

Declaration
public Task<EMailEntity> GetEMailFromDocumentIdAsync(int documentId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int documentId

Unique id of the document

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The e-mail

GetEMailFromDocumentIdWithoutAttachmentStreamAsync(int, CancellationToken)

Get an e-mail based on an archived document

Declaration
public Task<EMailEntity> GetEMailFromDocumentIdWithoutAttachmentStreamAsync(int documentId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int documentId

Unique id of the document

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The e-mail

GetEMailFromIdAsync(EMailConnectionInfo, int, bool, EMailFlags, bool, CancellationToken)

Get en e-mail based on its unique id

Declaration
public Task<EMailEntity> GetEMailFromIdAsync(EMailConnectionInfo connectionInfo, int messageServerId, bool lookupAddresses, EMailFlags flags, bool includeAttachments, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

int messageServerId

Unique ID for the e-mail to retrieve

bool lookupAddresses

If true try to look up e-mail addresses in from/to/cc/bcc fields against superoffice contacts

SuperOffice.Data.EMailFlags flags

Any flags to apply to the fetched item. Ex: Seen/Answered

bool includeAttachments

Should we retrieve attachments embedded in the e-mail from the server

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The e-mail

GetEMailFromTempAsync(string, CancellationToken)

Declaration
public Task<EMailEntity> GetEMailFromTempAsync(string fileName, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string fileName
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

GetEMailSOInfoAsync(int, CancellationToken)

Gets a EMailSOInfo object.

Declaration
public Task<EMailSOInfo> GetEMailSOInfoAsync(int eMailSOInfoId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int eMailSOInfoId

The identifier of the EMailSOInfo object

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailSOInfo

A single EMailSOInfo

GetEmailAppointmentAsync(int, CancellationToken)

Get appointment data contained in the emails iCal attachment

Declaration
public Task<EMailAppointment> GetEmailAppointmentAsync(int mailItemId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int mailItemId

Id identifying the email

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAppointment

Appointment data

GetEmailAppointmentRecurrenceAsync(int, CancellationToken)

Get recurrence data contained in the email iCal attachment

Declaration
public Task<RecurrenceInfo> GetEmailAppointmentRecurrenceAsync(int mailItemId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int mailItemId

Id identifying the email

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskSuperOffice.CRM.Services.RecurrenceInfo

Recurrence information

GetEmailDocumentAsMimeStreamAsync(int, CancellationToken)

Gets a particular document, and tries to parse it, and returns it in MIME/RFC822 format.

Declaration
public Task<Stream> GetEmailDocumentAsMimeStreamAsync(int documentId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int documentId

SuperOffice document ID

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskStream

A document-stream representing the document in MIME/RFC822 format.

GetEmailMessageIdsAsync(EMailConnectionInfoExtended, CancellationToken)

Declaration
public Task<string[]> GetEmailMessageIdsAsync(EMailConnectionInfoExtended connectionInfoExtended, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfoExtended connectionInfoExtended
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskstring

GetEmailsAsStringAsync(EMailConnectionInfoExtended, string[], CancellationToken)

Declaration
public Task<string[]> GetEmailsAsStringAsync(EMailConnectionInfoExtended connectionInfoExtended, string[] messageIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfoExtended connectionInfoExtended
string messageIds
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskstring

GetExtendedEmailMessageIdsAsync(EMailConnectionInfoExtended, CancellationToken)

Gets not only the Message-Id's but also the UID's and the uniquevalidity property in this format-> uvalidity:uid:MsgId - and this format should be understood by GetEmailsAsString() and DeleteExtended().

Declaration
public Task<string[]> GetExtendedEmailMessageIdsAsync(EMailConnectionInfoExtended connectionInfoExtended, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfoExtended connectionInfoExtended
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskstring

GetFolderEMailCountAsync(EMailConnectionInfo, bool, CancellationToken)

Retrieve total/unread mail items in current folder

Declaration
public Task<int> GetFolderEMailCountAsync(EMailConnectionInfo connectionInfo, bool onlyUnread, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

bool onlyUnread

If true, only unread items are counted

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskint

Number of mail items

GetFolderHasNewEMailAsync(EMailConnectionInfo, CancellationToken)

Check if folder has received new items since previous access.

Declaration
public Task<bool> GetFolderHasNewEMailAsync(EMailConnectionInfo connectionInfo, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskbool

True if new mail is available.

GetFolderInfoAsync(EMailConnectionInfo, string[], CancellationToken)

Retrieve information about folders. If folders parameter is not specified(null), information about all subscribed folders will be returned.

Declaration
public Task<EMailFolder[]> GetFolderInfoAsync(EMailConnectionInfo connectionInfo, string[] folders, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

string folders

Folders to get information about.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailFolder

Folder information

GetFolderListAsync(EMailConnectionInfo, bool, CancellationToken)

Retrieve all folders for the mail account. String is separated in sections by the paragraph character. First section contains the folder delimeter char. Next is folder name. Additional sections may be unread and total items.

Declaration
public Task<string[]> GetFolderListAsync(EMailConnectionInfo connectionInfo, bool includeItemCount, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

bool includeItemCount

If true, unread and total items are added to the foldername separated by a comma

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskstring

List of available folders as a string array

GetMailFromInReplyToAsync(string, CancellationToken)

Get email from db based on In-Reply-To Message Id

Declaration
public Task<EMailEntity> GetMailFromInReplyToAsync(string messageId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string messageId

The message id

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

EMailEntity that is in reply to the provided messageId

GetMailFromMessageIdAsync(string, CancellationToken)

Get email from db based on Message Id

Declaration
public Task<EMailEntity> GetMailFromMessageIdAsync(string messageId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string messageId

The message id

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

EMailEntity with the provided message id

GetNewMailAsync(int[], CancellationToken)

Get new email in folder(s) for current associate

Declaration
public Task<EMailEnvelope[]> GetNewMailAsync(int[] folders, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int folders

List of folder ids to check for new email

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEnvelope

The downloaded email envelopes

GetParticipantInfoFromEmailAddressAsync(string, int, CancellationToken)

Get participant data associated with the participant in the emails iCal attachment

Declaration
public Task<Person> GetParticipantInfoFromEmailAddressAsync(string emailAddress, int appointmentId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string emailAddress

Email address of participant

int appointmentId

Appointment id of participant

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskPerson

Person information

GetPersonEntitiesFromEmailAddressAsync(string, CancellationToken)

Get all persons and contacts with the given email address

Declaration
public Task<PersonEntity[]> GetPersonEntitiesFromEmailAddressAsync(string emailAddress, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string emailAddress

The emailAddress to find persons and contacts for

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskPersonEntity

GetPersonsFromEmailAddressAsync(string, CancellationToken)

Get all persons and contacts with the given email address

Declaration
public Task<Person[]> GetPersonsFromEmailAddressAsync(string emailAddress, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string emailAddress

The emailAddress to find persons and contacts for

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskPerson

GetPreviewAttachmentFromDocIdAsync(int, string, CancellationToken)

Retrieve an attachment from an e-mail stored in the document archive. The returned data is intended to be use for a preview.

Declaration
public Task<EMailAttachment> GetPreviewAttachmentFromDocIdAsync(int docId, string attachmentId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int docId

Unique ID for the e-mail in the document archive to retrieve the attachment from

string attachmentId

Id of the attachment in the e-mail

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAttachment

The attachment

GetPreviewAttachmentFromIdAsync(int, string, string, string, CancellationToken)

Retrieve an attachment from an e-mail. The returned data is intended to be use for a preview.

Declaration
public Task<EMailAttachment> GetPreviewAttachmentFromIdAsync(int mailItemId, string attachmentId, string attachmentType, string attachmentFilename, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int mailItemId

Unique ID for the e-mail to retrieve the attachment from

string attachmentId

Id of the attachment in the e-mail

string attachmentType

Mimetype of the attachment. Must be set if attachmentId contains a chain.

string attachmentFilename

Filename of the attachment. Must be set if attachmentId contains a chain.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAttachment

The attachment

GetReadySyncEmailAccountsAsync(CancellationToken)

Gets the list of SyncUserAccounts that should be synced, from mail server to SuperOffice database cache.

Declaration
public Task<SyncUserAccount[]> GetReadySyncEmailAccountsAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskSyncUserAccount

List of accounts to sync

GetUnsanitizedEMailAsync(int, bool, CancellationToken)

Get en e-mail based on its primary key in the DB. The returned value is not sanitized.

Declaration
public Task<EMailEntity> GetUnsanitizedEMailAsync(int id, bool includeAttachments, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int id

The primary key of the email row in the DB

bool includeAttachments

Should we retrieve attachments embedded in the e-mail from the server

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The e-mail

GetUnsanitizedEMailFromAttachmentIdAsync(int, string[], bool, CancellationToken)

Get an e-mail based on an email and attachment id. The returned value is not sanitized.

Declaration
public Task<EMailEntity> GetUnsanitizedEMailFromAttachmentIdAsync(int emailId, string[] attachmentIds, bool includeAttachments, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int emailId

The primary key of the email row in the DB

string attachmentIds

Id of the attachment. If multiple elements this is treated as attachment in attachemnts, e.g. [1, 2] means attachment 2 in attachment 1 of email.

bool includeAttachments

Should we retrieve attachments embedded in the e-mail from the server

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The attachment as an e-mail

GetUnsanitizedEMailFromDocumentAttachmentIdAsync(int, string[], bool, CancellationToken)

Get an e-mail based on an email in the archive system and attachment id. The returned value is not sanitized.

Declaration
public Task<EMailEntity> GetUnsanitizedEMailFromDocumentAttachmentIdAsync(int docId, string[] attachmentIds, bool includeAttachments, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int docId

The primary key of the document row in the DB

string attachmentIds

Id of the attachment. If multiple elements this is treated as attachment in attachemnts, e.g. [1, 2] means attachment 2 in attachment 1 of email.

bool includeAttachments

Should we retrieve attachments embedded in the e-mail from the server

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The attachment as an e-mail

GetUnsanitizedEMailFromDocumentIdAsync(int, CancellationToken)

Get an e-mail based on an archived document. The returned value is not sanitized.

Declaration
public Task<EMailEntity> GetUnsanitizedEMailFromDocumentIdAsync(int documentId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int documentId

Unique id of the document

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The e-mail

GetUnsanitizedEMailFromDocumentIdWithoutAttachmentStreamAsync(int, CancellationToken)

Get an e-mail based on an archived document. The returned value is not sanitized.

Declaration
public Task<EMailEntity> GetUnsanitizedEMailFromDocumentIdWithoutAttachmentStreamAsync(int documentId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int documentId

Unique id of the document

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The e-mail

GetUnsanitizedPreviewAttachmentFromDocIdAsync(int, string, CancellationToken)

Retrieve an attachment from an e-mail stored in the document archive. The returned data is intended to be use for a preview. The returned data is not sanitized.

Declaration
public Task<EMailAttachment> GetUnsanitizedPreviewAttachmentFromDocIdAsync(int docId, string attachmentId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int docId

Unique ID for the e-mail in the document archive to retrieve the attachment from

string attachmentId

Id of the attachment in the e-mail

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAttachment

The attachment

GetUnsanitizedPreviewAttachmentFromIdAsync(int, string, string, string, CancellationToken)

Retrieve an attachment from an e-mail. The returned data is intended to be use for a preview. The returned data is not sanitized.

Declaration
public Task<EMailAttachment> GetUnsanitizedPreviewAttachmentFromIdAsync(int mailItemId, string attachmentId, string attachmentType, string attachmentFilename, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int mailItemId

Unique ID for the e-mail to retrieve the attachment from

string attachmentId

Id of the attachment in the e-mail

string attachmentType

Mimetype of the attachment. Must be set if attachmentId contains a chain.

string attachmentFilename

Filename of the attachment. Must be set if attachmentId contains a chain.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAttachment

The attachment

HasMXRecordAsync(string, CancellationToken)

Return true if there is one or more MX records in DNS for the given mail domain

Declaration
public Task<bool> HasMXRecordAsync(string mailDomain, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string mailDomain

The mail domain to check. Normally this is the part after @ in an email address

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskbool

True if there is at least one MX record

HasNewMailAsync(int, int, CancellationToken)

Fast check for new mail in the database

Declaration
public Task<bool> HasNewMailAsync(int mailItemId, int folderId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int mailItemId

The last known mailitemid

int folderId

The folderId for the folder to check for new mail

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskbool

Has new mail if true

HasSPFRecordAsync(string, string, CancellationToken)

Return true if target domain contains a SPF record which is under the given SPF record

Declaration
public Task<bool> HasSPFRecordAsync(string sourceSpf, string targetDomain, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string sourceSpf

The SPF to match from

string targetDomain

The domain to verify if it has at least one SPF record contained in the source SPF

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskbool

True if a match is found

LatestItemIdByFolderAsync(int, CancellationToken)

Returns the latest id of the mail item by folder

Declaration
public Task<int> LatestItemIdByFolderAsync(int folderId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int folderId

The folderId for the folder to check for the latest mail id

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskint

Mail Item id

MarkAsReadAsync(EMailConnectionInfo, int[], bool, CancellationToken)

Mark one or more e-mails as (un)read

Declaration
public Task MarkAsReadAsync(EMailConnectionInfo connectionInfo, int[] messageServerIds, bool read, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

int messageServerIds

The e-mails to handle

bool read

If true mails are marked as read. If false mails are marked as unread.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

MarkEmailsAsReadAsync(int[], bool, CancellationToken)

Mark one or more e-mails as (un)read

Declaration
public Task MarkEmailsAsReadAsync(int[] ids, bool read, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int ids

The e-mails to handle

bool read

If true mails are marked as read. If false mails are marked as unread.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

MoveEmailsToFolderAsync(int, int[], CancellationToken)

Move one or more emails to the specified folder in the DB, and on the server

Declaration
public Task MoveEmailsToFolderAsync(int folderId, int[] emailItemIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int folderId

The EmailFolderId of the folder to move to

int emailItemIds

The emails to move

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

MoveEmailsToTrashAsync(int[], CancellationToken)

Delete specified mail items and move to the Trash folder

Declaration
public Task MoveEmailsToTrashAsync(int[] ids, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int ids

The e-mails to handle

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

MoveToFolderAsync(EMailConnectionInfo, int[], string, CancellationToken)

Moved specified items from current folder to targetFolder

Declaration
public Task MoveToFolderAsync(EMailConnectionInfo connectionInfo, int[] messageServerIds, string targetFolder, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

int messageServerIds

The e-mails to handle

string targetFolder

Name of folder to move items to

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

RefreshFolderAsync(EMailConnectionInfo, string[], CancellationToken)

Refresh the given folders - i.e., fetch data from the mail server and update the in-database cache. This may happen synchronously or as a batch task, the return value will be 0 if the processing was synchronous, or the batch task id if a batch task is used.

Declaration
public Task<int> RefreshFolderAsync(EMailConnectionInfo connectionInfo, string[] folders, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

Email connection info credentials

string folders

List of folder names to refresh

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskint

Batch task id, or 0 if the processing was synchronous

RefreshFolderForAssociateAsync(string[], CancellationToken)

Get all emails in folder(s) from current associate

Declaration
public Task<string> RefreshFolderForAssociateAsync(string[] folders, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string folders

List of folder names to refresh

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskstring

JSON serialized string containing array of data about each folder

RelayMessageAsync(EMailConnectionInfoExtended, string, string, string[], CancellationToken)

Declaration
public Task RelayMessageAsync(EMailConnectionInfoExtended connectionInfoExtended, string rfc822, string from, string[] recipients, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfoExtended connectionInfoExtended
string rfc822
string from
string recipients
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

ResolveEMailRecipientsAsync(string, CancellationToken)

Resolve separate emails from single string. Also lookup persons by emails.

Declaration
public Task<EMailAddress[]> ResolveEMailRecipientsAsync(string emailAddress, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string emailAddress

The string to lookup emails from

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAddress

Resolved EMail recipients

SaveAsync(EMailEntity, CancellationToken)

Save the e-mail back to the database

Declaration
public Task<EMailEntity> SaveAsync(EMailEntity email, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailEntity email

The e-mail to save

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The updated saved entity

SaveDraftAsync(EMailEntity, CancellationToken)

Save the Email entity to the drafts folder

Declaration
public Task<EMailEntity> SaveDraftAsync(EMailEntity entity, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailEntity entity

The entity to save

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The saved e-mail entity

SaveEMailAccountAsync(EMailAccount, CancellationToken)

Updates the existing EMailAccount or creates a new EMailAccount if the id parameter is 0.

Declaration
public Task<EMailAccount> SaveEMailAccountAsync(EMailAccount eMailAccount, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailAccount eMailAccount

The EMailAccount that is saved

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailAccount

New or updated EMailAccount

SaveEMailAsync(EMailConnectionInfo, EMailEntity, CancellationToken)

Save the passed e-mail back to the server

Declaration
public Task<EMailEntity> SaveEMailAsync(EMailConnectionInfo connectionInfo, EMailEntity email, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

EMailEntity email

The e-mail to save

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The updated saved entity

SaveEmailToTmpDocumentAsync(EMailEntity, int, bool, CancellationToken)

Save the Email as a tmp document ready to archive

Declaration
public Task<string> SaveEmailToTmpDocumentAsync(EMailEntity email, int folderId, bool stripAttachments, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailEntity email

The e-mail to save

int folderId

The folder id where the email is

bool stripAttachments

If true, do not include attachments in tmp document

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskstring

Filename of the tmp document

SaveToMailServerAsync(EMailEntity, CancellationToken)

Save the passed e-mail back to the mail server

Declaration
public Task<EMailEntity> SaveToMailServerAsync(EMailEntity email, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailEntity email

The e-mail to save

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The updated saved entity

SendAndSaveEmailToTmpDocumentAsync(EMailEntity, bool, CancellationToken)

Send the provided e-mail and create tmp document ready to archive

Declaration
public Task<string> SendAndSaveEmailToTmpDocumentAsync(EMailEntity email, bool stripAttachments, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailEntity email

The e-mail to send

bool stripAttachments

If true, do not include attachments in tmp document

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskstring

Filename of the tmp document

SendAsync(EMailEntity[], CancellationToken)

Send the provided e-mails

Declaration
public Task<EMailEntity[]> SendAsync(EMailEntity[] emails, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailEntity emails

The e-mails to send

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The sent e-mails (updated with message id etc.)

SendEMailsAsync(EMailConnectionInfo, EMailEntity[], EMailConnectionInfo, CancellationToken)

Send the provided e-mails

Declaration
public Task<EMailEntity[]> SendEMailsAsync(EMailConnectionInfo outgoingConnectionInfo, EMailEntity[] emails, EMailConnectionInfo sentItemsConnectionInfo, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo outgoingConnectionInfo

All information needed to connect to the mailserver

EMailEntity emails

The e-mails to send

EMailConnectionInfo sentItemsConnectionInfo

If provided, save sent item(s) in the folder specified. May be null.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
TaskEMailEntity

The sent e-mails (updated with message id etc.)

SetRepliedAtAsync(string, CancellationToken)

Set the replied_at field based on the MessageID

Declaration
public Task SetRepliedAtAsync(string messageId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string messageId

The MessageID

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

SetSubscriptionAsync(EMailConnectionInfo, EMailFolder[], CancellationToken)

Set subscription on or off on a set of folders

Declaration
public Task SetSubscriptionAsync(EMailConnectionInfo connectionInfo, EMailFolder[] folders, CancellationToken cancellationToken = default)
Parameters
Type Name Description
EMailConnectionInfo connectionInfo

All information needed to connect to the mailserver

EMailFolder folders

Folders to set subscription value on

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

SyncEmailAccountAsync(SyncUserAccount, CancellationToken)

Sync the given account, from mail server to SuperOffice database cache. This API has no throttling, so please be careful with multiple concurrent calls. Mail servers may become angry.

Declaration
public Task SyncEmailAccountAsync(SyncUserAccount syncUserAccount, CancellationToken cancellationToken = default)
Parameters
Type Name Description
SyncUserAccount syncUserAccount

Account to sync

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

A void return

SyncEmailAccountsAsync(SyncUserAccount[], CancellationToken)

Start syncing of the given accounts, from mail server to SuperOffice database cache. Only one of these API calls may run at a time. If one is already active, we return after 1 (one) second, with no indication that the sync was not really started. This is a way to throttle sync'ing to avoid making the mail servers angry at us. <br/> There is an <b>additional</b> level of throttling within the implementation as well, limiting us to a maximum of 10 tasks, regardless of how many associates are to to be sync'ed. The outer, API-level lock is released when all those tasks are done.

Declaration
public Task SyncEmailAccountsAsync(SyncUserAccount[] syncUserAccounts, CancellationToken cancellationToken = default)
Parameters
Type Name Description
SyncUserAccount syncUserAccounts

Accounts to sync

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

A void return

TestAuthenticateAsync(CancellationToken)

Test if logged-in user has a working mail account

Declaration
public Task<bool> TestAuthenticateAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Taskbool

ToggleSubscriptionAsync(int, bool, CancellationToken)

Set subscription on or off on a set of folders

Declaration
public Task ToggleSubscriptionAsync(int folderId, bool subscriptionStatus, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int folderId

The folder id to set subscription value on

bool subscriptionStatus

The subscription status to set

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

Implements

IEMailAgent
IAgent
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top