Class MailCache
Class that handles e-mail caching to the superoffice db
Namespace: SuperOffice.CRM.Mail
Assembly: SoDataBase.dll
Syntax
public static class MailCache : Object
Fields
RecipientConceptualType
Class that handles e-mail caching to the superoffice db
Declaration
public const string RecipientConceptualType = "RecipientList"
Field Value
Type | Description |
---|---|
String |
Methods
CacheMailForAssociate(Int32, SoMailCredentials, String)
Cache all subscribed mail folders or specified folder for a specified associate
Declaration
public static bool CacheMailForAssociate(int associateId, SoMailCredentials credentials, string folder)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Id of associate to cache folders for |
SoMailCredentials | credentials | Login credentials for mail server/account |
String | folder | If specified, cache only this folder |
Returns
Type | Description |
---|---|
Boolean | True if one or more new messages was found on the server. Checked against the message id. |
CacheMailForAssociate(Int32, SoMailCredentials, String, out Int32, out Int32, out Int32)
Cache all subscribed mail folders or specified folder for a specified associate
Declaration
public static bool CacheMailForAssociate(int associateId, SoMailCredentials credentials, string folder, out int folderCount, out int downloadedEnvelopeCount, out int cachedEnvelopeCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Id of associate to cache folders for |
SoMailCredentials | credentials | Login credentials for mail server/account |
String | folder | If specified, cache only this folder |
Int32 | folderCount | out parameter, returns number of envelopes in selected folder |
Int32 | downloadedEnvelopeCount | out parameter, returns number of new elements downloaded |
Int32 | cachedEnvelopeCount | out parameter, returns number of envelopes in cache |
Returns
Type | Description |
---|---|
Boolean | True if one or more new messages was found on the server. |
ClearCachedFolderInfo(Int32, String, String)
Cache mail folder info to the database
Declaration
public static void ClearCachedFolderInfo(int assocId, string server, string username)
Parameters
Type | Name | Description |
---|---|---|
Int32 | assocId | Associate to cache item for |
String | server | Mail server |
String | username | Mail server account |
findFolderSeparator(Int32)
Class that handles e-mail caching to the superoffice db
Declaration
public static string findFolderSeparator(int accountId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | accountId |
Returns
Type | Description |
---|---|
String |
FindMessageInIdList(MailEnvelope, Int32[])
returns true if a message exists in the given list of messageids
Declaration
public static bool FindMessageInIdList(MailEnvelope envelope, int[] idList)
Parameters
Type | Name | Description |
---|---|---|
MailEnvelope | envelope | |
Int32[] | idList |
Returns
Type | Description |
---|---|
Boolean |
findOrCreateEmailFolder(Int32, MailFolder, Boolean)
Class that handles e-mail caching to the superoffice db
Declaration
public static int[] findOrCreateEmailFolder(int accountId, MailFolder folder, bool updateAttributes = false)
Parameters
Type | Name | Description |
---|---|---|
Int32 | accountId | |
MailFolder | folder | |
Boolean | updateAttributes |
Returns
Type | Description |
---|---|
Int32[] | An array of folder ids, with the element in the first index of the array the topmost parent |
findOrCreateEmailFolder(Int32, String, String)
Class that handles e-mail caching to the superoffice db
Declaration
public static int[] findOrCreateEmailFolder(int accountId, string folder, string delimiter = "")
Parameters
Type | Name | Description |
---|---|---|
Int32 | accountId | |
String | folder | |
String | delimiter |
Returns
Type | Description |
---|---|
Int32[] | An array of folder ids, with the element in the first index of the array the topmost parent |
GetCachedEnvelopes(Int32, String, String, String)
Class that handles e-mail caching to the superoffice db
Declaration
public static MailEnvelope[] GetCachedEnvelopes(int assocId, string server, string username, string folder)
Parameters
Type | Name | Description |
---|---|---|
Int32 | assocId | |
String | server | |
String | username | |
String | folder |
Returns
Type | Description |
---|---|
MailEnvelope[] |
GetCachedEnvelopes(Int32, String, String, String, out DateTime)
Get cached envelopes of a folder for a specified associate
Declaration
public static MailEnvelope[] GetCachedEnvelopes(int assocId, string server, string username, string folder, out DateTime lastMailDate)
Parameters
Type | Name | Description |
---|---|---|
Int32 | assocId | Id of associate |
String | server | Mail server |
String | username | Mail server account |
String | folder | Name of folder |
DateTime | lastMailDate | Date and time of arrival at mail server, of latest mail |
Returns
Type | Description |
---|---|
MailEnvelope[] | Populated MailEnvelope array |
GetCachedEnvelopes(Int32, String, String, String, out Int32)
Get cached envelopes of a folder for a specified associate
Declaration
public static MailEnvelope[] GetCachedEnvelopes(int assocId, string server, string username, string folder, out int lastMailUID)
Parameters
Type | Name | Description |
---|---|---|
Int32 | assocId | Id of associate |
String | server | Mail server |
String | username | Mail server account |
String | folder | Name of folder |
Int32 | lastMailUID |
Returns
Type | Description |
---|---|
MailEnvelope[] | Populated MailEnvelope array |
GetCachedFolderInfo(Int32, String, String, String[])
Returns the number of items in a given list of folders
Declaration
public static SoMailFolderInfo[] GetCachedFolderInfo(int assocId, string server, string username, string[] folderList)
Parameters
Type | Name | Description |
---|---|---|
Int32 | assocId | Id of associate to retrieve item from |
String | server | Mail server |
String | username | Mail server account |
String[] | folderList | List of folder names to return count from |
Returns
Type | Description |
---|---|
SoMailFolderInfo[] |
GetCachedFolderList(Int32, SoMailCredentials)
Returns a cached list of folders
Declaration
public static string[] GetCachedFolderList(int assocId, SoMailCredentials credentials)
Parameters
Type | Name | Description |
---|---|---|
Int32 | assocId | Id of associate to retrieve item from |
SoMailCredentials | credentials | Mail server credentials |
Returns
Type | Description |
---|---|
String[] |
GetCachedMailItem(Int32, String, String, Int32, String, Boolean)
Look for and return a MailItem from the database. If item is not found, null is returned.
Declaration
public static MailItem GetCachedMailItem(int assocId, string server, string username, int messageId, string folder, bool includeAttachments)
Parameters
Type | Name | Description |
---|---|---|
Int32 | assocId | Id of associate to retrieve item from |
String | server | Mail server |
String | username | Mail server account |
Int32 | messageId | Id of message to retrieve |
String | folder | The item belongs to this folder |
Boolean | includeAttachments | If true, cached object need to contain all attachments |
Returns
Type | Description |
---|---|
MailItem | MailItem object, or null if no object is found |
GetCachingStarted(Int32, SoMailCredentials)
Check if there is a ForeignKey record that matches the account, has the active subkey, and is between 0 and 60 minutes old
Declaration
public static bool GetCachingStarted(int associateId, SoMailCredentials credentials)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | |
SoMailCredentials | credentials |
Returns
Type | Description |
---|---|
Boolean |
GetDraftsFolderName(Int32)
Class that handles e-mail caching to the superoffice db
Declaration
public static string GetDraftsFolderName(int accountId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | accountId |
Returns
Type | Description |
---|---|
String |
GetEmailAccountId(Int32, String, String)
Class that handles e-mail caching to the superoffice db
Declaration
public static int GetEmailAccountId(int assocId, string server, string username)
Parameters
Type | Name | Description |
---|---|---|
Int32 | assocId | |
String | server | |
String | username |
Returns
Type | Description |
---|---|
Int32 |
GetEnvelopeFromDataReader(SoDataReader)
Class that handles e-mail caching to the superoffice db
Declaration
public static MailEnvelope GetEnvelopeFromDataReader(SoDataReader reader)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | reader |
Returns
Type | Description |
---|---|
MailEnvelope |
GetFolderName(EmailFolderRow)
Constructs the full directory path from the given folder row to the root folder.
Declaration
public static string GetFolderName(EmailFolderRow folderRow)
Parameters
Type | Name | Description |
---|---|---|
EmailFolderRow | folderRow |
Returns
Type | Description |
---|---|
String |
GetFolderName(Int32)
Constructs the full directory path from the given folder to the root folder.
Declaration
public static string GetFolderName(int folderId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | folderId |
Returns
Type | Description |
---|---|
String |
GetInboxFolderName(Int32, Boolean)
Class that handles e-mail caching to the superoffice db
Declaration
public static string GetInboxFolderName(int accountId, bool create = true)
Parameters
Type | Name | Description |
---|---|---|
Int32 | accountId | |
Boolean | create |
Returns
Type | Description |
---|---|
String |
GetMailItemFromDataReader(SoDataReader)
Class that handles e-mail caching to the superoffice db
Declaration
public static MailItem GetMailItemFromDataReader(SoDataReader reader)
Parameters
Type | Name | Description |
---|---|---|
SoDataReader | reader |
Returns
Type | Description |
---|---|
MailItem |
GetMailItemFromDbRow(EmailItemRow, Boolean, Boolean)
Class that handles e-mail caching to the superoffice db
Declaration
public static MailItem GetMailItemFromDbRow(EmailItemRow row, bool mime = false, bool streams = false)
Parameters
Type | Name | Description |
---|---|---|
EmailItemRow | row | |
Boolean | mime | |
Boolean | streams |
Returns
Type | Description |
---|---|
MailItem |
GetMinimalMailEnvelope(Int32, EMailFlags)
Class that handles e-mail caching to the superoffice db
Declaration
public static MailEnvelope GetMinimalMailEnvelope(int serverId, EMailFlags flags)
Parameters
Type | Name | Description |
---|---|---|
Int32 | serverId | |
EMailFlags | flags |
Returns
Type | Description |
---|---|
MailEnvelope |
GetSentFolderName(Int32, Boolean)
Get the full name of the first folder with the Sent attribute in the database.
Declaration
public static string GetSentFolderName(int accountId, bool create = true)
Parameters
Type | Name | Description |
---|---|---|
Int32 | accountId | |
Boolean | create |
Returns
Type | Description |
---|---|
String |
GetSentFolderNames(Int32)
Get all folders marked with the Sent folder attribute
Declaration
public static string[] GetSentFolderNames(int emailAccountId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | emailAccountId |
Returns
Type | Description |
---|---|
String[] |
GetSpecialFolderName(Int32, Int32)
Get all folders for a given account with the provided folder attribute
Declaration
public static string GetSpecialFolderName(int accountId, int folderAttribute)
Parameters
Type | Name | Description |
---|---|---|
Int32 | accountId | |
Int32 | folderAttribute | EMailFolderAttributeConstants |
Returns
Type | Description |
---|---|
String |
GetSpecialFolderNames(Int32, Int32)
Class that handles e-mail caching to the superoffice db
Declaration
public static string[] GetSpecialFolderNames(int accountId, int folderAttribute)
Parameters
Type | Name | Description |
---|---|---|
Int32 | accountId | |
Int32 | folderAttribute |
Returns
Type | Description |
---|---|
String[] |
GetTrashFolderName(Int32)
Get the full name of the folder with the Trash attribute in the database.
Declaration
public static string GetTrashFolderName(int accountId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | accountId |
Returns
Type | Description |
---|---|
String |
SetCachedFolderInfo(Int32, String, String, SoMailFolderInfo[])
Cache mail folder info to the database
Declaration
public static void SetCachedFolderInfo(int assocId, string server, string username, SoMailFolderInfo[] folderInfo)
Parameters
Type | Name | Description |
---|---|---|
Int32 | assocId | Associate to cache item for |
String | server | Mail server |
String | username | Mail server account |
SoMailFolderInfo[] | folderInfo | Folder information to cache |
SetCachingFinished(Int32, SoMailCredentials)
Update the ForeignKey record to Inactive SubKey value
Declaration
public static void SetCachingFinished(int associateId, SoMailCredentials credentials)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | |
SoMailCredentials | credentials |
SetCachingStarted(Int32, SoMailCredentials)
If needed, create the ForeignKey record; make sure sure it has the Actvie Subkey value, and updated = Now
Declaration
public static void SetCachingStarted(int associateId, SoMailCredentials credentials)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | |
SoMailCredentials | credentials |
UpdateCacheWithNewEMail(Int32, SoMailCredentials, String)
Updates the cache with new email that has arrived after the last one in the cache.
Declaration
public static bool UpdateCacheWithNewEMail(int associateId, SoMailCredentials credentials, string folder)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | Id of associate to cache folders for |
SoMailCredentials | credentials | Login credentials for mail server/account |
String | folder | If specified, cache only this folder |
Returns
Type | Description |
---|---|
Boolean | True if one or more new messages was found on the server. Checked against the message id. |
UpdateRecipientList(Int32, MailEnvelope)
Class that handles e-mail caching to the superoffice db
Declaration
public static void UpdateRecipientList(int assosciateId, MailEnvelope mail)
Parameters
Type | Name | Description |
---|---|---|
Int32 | assosciateId | |
MailEnvelope |
UpdateStatusAndDeletedEnvelopes(Int32, SoMailCredentials, String)
Checks all messages in the cache and removes deleted and changes status.
Declaration
public static bool UpdateStatusAndDeletedEnvelopes(int associateId, SoMailCredentials credentials, string folder)
Parameters
Type | Name | Description |
---|---|---|
Int32 | associateId | |
SoMailCredentials | credentials | |
String | folder |
Returns
Type | Description |
---|---|
Boolean |