Show / Hide Table of Contents

Class MailItemProvider

Provides populated mail envelope rows as an archive

Inheritance
object
MailItemProvider
Implements
IArchiveProvider
IArchiveProviderHasRows
IArchiveProviderHasColumns
IArchiveProviderHasEntities
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.CRM.ArchiveLists
Assembly: SoDataBase.BusinessLogic.dll
Syntax
[ArchiveProvider("Mail", 1073741823)]
public class MailItemProvider : IArchiveProvider, IArchiveProviderHasRows, IArchiveProviderHasColumns, IArchiveProviderHasEntities

Constructors

MailItemProvider()

Constructor

Declaration
public MailItemProvider()

Fields

_colArchived

Provides populated mail envelope rows as an archive

Declaration
protected ArchiveColumnInfo _colArchived
Field Value
Type Description
ArchiveColumnInfo

_colAttachment

Provides populated mail envelope rows as an archive

Declaration
protected ArchiveColumnInfo _colAttachment
Field Value
Type Description
ArchiveColumnInfo

_colCompany

Provides populated mail envelope rows as an archive

Declaration
protected ArchiveColumnInfo _colCompany
Field Value
Type Description
ArchiveColumnInfo

_colFrom

Provides populated mail envelope rows as an archive

Declaration
protected ArchiveColumnInfo _colFrom
Field Value
Type Description
ArchiveColumnInfo

_colId

Provides populated mail envelope rows as an archive

Declaration
protected ArchiveColumnInfo _colId
Field Value
Type Description
ArchiveColumnInfo

_colPerson

Provides populated mail envelope rows as an archive

Declaration
protected ArchiveColumnInfo _colPerson
Field Value
Type Description
ArchiveColumnInfo

_colPriority

Provides populated mail envelope rows as an archive

Declaration
protected ArchiveColumnInfo _colPriority
Field Value
Type Description
ArchiveColumnInfo

_colSent

Provides populated mail envelope rows as an archive

Declaration
protected ArchiveColumnInfo _colSent
Field Value
Type Description
ArchiveColumnInfo

_colSize

Provides populated mail envelope rows as an archive

Declaration
protected ArchiveColumnInfo _colSize
Field Value
Type Description
ArchiveColumnInfo

_colStatus

Provides populated mail envelope rows as an archive

Declaration
protected ArchiveColumnInfo _colStatus
Field Value
Type Description
ArchiveColumnInfo

_colSubject

Provides populated mail envelope rows as an archive

Declaration
protected ArchiveColumnInfo _colSubject
Field Value
Type Description
ArchiveColumnInfo

_colTo

Provides populated mail envelope rows as an archive

Declaration
protected ArchiveColumnInfo _colTo
Field Value
Type Description
ArchiveColumnInfo

Properties

FavorPartialEnvelopes

Should we try to fetch partial envelopes when possible Saves some bandwidth, but subclasses may need more info

Declaration
protected virtual bool FavorPartialEnvelopes { get; }
Property Value
Type Description
bool

IsInitialized

Provides populated mail envelope rows as an archive

Declaration
public bool IsInitialized { get; }
Property Value
Type Description
bool

Methods

Close()

Call this method after the last desired row has been read; this gives the provider the chance to close and free any underlying queries

Declaration
public void Close()

GetAvailableColumns()

Get a list of available columns for this provider

Declaration
public List<ArchiveColumnInfo> GetAvailableColumns()
Returns
Type Description
List<ArchiveColumnInfo>

GetAvailableEntities()

Get available entities for this provider

Declaration
public List<ArchiveRowTypeInfo> GetAvailableEntities()
Returns
Type Description
List<ArchiveRowTypeInfo>

GetReaderAsync(string, CancellationToken)

Start the provider, returning an IDataReader compatible object to the client for row enumeration and data access

Declaration
public virtual Task<DbDataReader> GetReaderAsync(string options, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string options

Options, passed to the internal GetRows method

CancellationToken cancellationToken
Returns
Type Description
Task<DbDataReader>

IDataReader primed to provide results

GetResultInformationAsync()

Get additional information about the result, such as row count or other optional items. This method should be called after GetRowsAsync(string, CancellationToken), but before Close.

Declaration
public Task<ArchiveResultInformation> GetResultInformationAsync()
Returns
Type Description
Task<ArchiveResultInformation>

GetRowsAsync(string, CancellationToken)

Iterator over all rows in the archive, suitable for a foreach access. It is typically implemented using the yield keyword.

Declaration
public IAsyncEnumerable<ArchiveRow> GetRowsAsync(string options, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string options
CancellationToken cancellationToken
Returns
Type Description
IAsyncEnumerable<ArchiveRow>

IsEnvelopeWanted(MailEnvelope, bool, bool, bool)

Do the user want to see this envelope

Declaration
protected virtual bool IsEnvelopeWanted(MailEnvelope env, bool toContactsWanted, bool toAssociatesWanted, bool toOthersWanted)
Parameters
Type Name Description
MailEnvelope env

Envelope to check

bool toContactsWanted

Do the user want to see mail from so contacts

bool toAssociatesWanted

Do the user want to see mail from associates

bool toOthersWanted

Do the user want to see unrecognized mails

Returns
Type Description
bool

True if envelope should be displayed

MapColumnToDbId(string)

Map a named column (usually a restriction column) to a database field id.

Declaration
public int MapColumnToDbId(string columnName)
Parameters
Type Name Description
string columnName

Name of column to map

Returns
Type Description
int

Database field id if available, otherwise 0

Remarks

In some cases we may need to map a column of an archive list provider to a unique database field. This is mostly required in order to fetch and store search criteria, both for Dynamic Selections and for other kinds of searches. Columns that are not mappable through this interface cannot be saved and restored, and are therefore not available as criteria for search functions (dynamic selection)

MapDbIdToColumn(int)

Map an integer database field id to a qualified column name

Declaration
public string MapDbIdToColumn(int columnId)
Parameters
Type Name Description
int columnId

Field id of column to map

Returns
Type Description
string

Name of column that matches the given field id, or a blank string if there is no match

SetDesiredColumns(params string[])

Set which columns should actually be returned, must be a subset of the GetAvailableColumns result

Declaration
public void SetDesiredColumns(params string[] columnIds)
Parameters
Type Name Description
string[] columnIds

Array of column ID's representing the desired columns

SetDesiredEntities(params string[])

Provides populated mail envelope rows as an archive

Declaration
public void SetDesiredEntities(params string[] entities)
Parameters
Type Name Description
string[] entities

Array of entity names, semantically equivalent to ArchiveEntityInfo.Name fields.

SetOrderBy(params ArchiveOrderByInfo[])

Provides populated mail envelope rows as an archive

Declaration
public void SetOrderBy(params ArchiveOrderByInfo[] orderBy)
Parameters
Type Name Description
ArchiveOrderByInfo[] orderBy

Array of order by items

SetPagingInfo(int, int)

Set the paging properties of the provider. The default is to fetch page zero, of one thousand (1000) rows. A more reasonable page size is probably around 100. Note that the query processing strategy may change for very large pages (more than 1000) and give significantly longer response times. Performance is improved by setting the page size low, as long as you don't set it lower than what you realistically expect to need (fetching multiple pages is more expensive than fetching one).

Declaration
public void SetPagingInfo(int pageSize, int pageNumber)
Parameters
Type Name Description
int pageSize

Desired page size

int pageNumber

Desired page number to return

SetRestriction(params ArchiveRestrictionInfo[])

Set restrictions used to fetch desired columns/entities.

Declaration
public virtual bool SetRestriction(params ArchiveRestrictionInfo[] restrictions)
Parameters
Type Name Description
ArchiveRestrictionInfo[] restrictions
Returns
Type Description
bool

Implements

IArchiveProvider
IArchiveProviderHasRows
IArchiveProviderHasColumns
IArchiveProviderHasEntities

Extension Methods

IArchiverProviderHasRowsExtensions.GetRowsAsync(IArchiveProviderHasRows, CancellationToken)
EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
ObjectExtensions.AssignByReflection<T>(T, T)
ObjectExtensions.GraphCopy<T>(T)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top