Attachments class properties

CurrentTotalAttachmentsSize property

Gets current size of all attachments together in bytes.

Syntax

public long CurrentTotalAttachmentsSize { get; }

 

Property Value

Type:    System.Int64

 

DataSource property

Gets attachments data in XML format.

Syntax

public XDocument DataSource { get; set; }

Property Value

Type:    System.Xml.Linq.XDocument

Remarks

The returned and expected XML format is this:

<DataSource>
	<File Name="attachment.txt" Extension="txt" Id="e7e48c7d-2f3c-489c-bc84-64de0513d527" 
		Bytes="3297">77u/QUFFQUFBRC8vLy8vQ … [shortened] … BWU1BQUFBQUFzPQ0K</File>
	<File Name="anotherFile.doc " Extension="doc" Id="58e6cfd6-a644-4560-94cb-11f1f176ba31" 
		Bytes="2382">QUFFQUFBRC8vLy8vQVFBQUFBQUFBQUFRQV  … [shortened] …  QUJnd0FBQUFBQ3c9PQ0K</File>
	<File … [shortened] … ></File>
</DataSource>

The File element repeats for every attached file.

The content of File elements consists of base64-coded byte data of the attached file.

Attribute Name contains name of the original file.

Attribute Extension contains extension of the original file.

Attribute Id’s value represents a unique identifier of an attachment.

Value of attribute Bytes gives the size of the attached file in bytes.

FileSizeExceededMessage property

Gets or sets an error message when added file size exceeds size limit.

Syntax

public string FileSizeExceededMessage { get; set; }

Property Value

Type:                    System.String

Default value:   “File size exceeded. Allowed size: {0} bytes”

The message is formatted before showing; the parameter {0} is replaced with the current value of property MaxFileLength.

Filter property

Gets or sets file extension filter.

Syntax

public string Filter { get; set; }

Property Value

Type:                    System.String

Default value:   “All files (*.*)|*.*|PDF (*.pdf)|*.pdf”

Remarks

For more details on how to set this property see property Filter of the OpenFileDialog class.

IsAddButtonVisible property

Gets or sets a flag indicating whether the “Add attachment” button is visible.

Syntax

public bool IsAddButtonVisible { get; set; }

Property Value

Type:    System.Boolean

 

MaxFileLength property

Gets or sets maximum size of single attachment file in bytes.

Syntax

Public int MaxFileSize { get; set; }

Property Value

Type:                    System.Int32

Default value:   4096000

 

MaxTotalAttachmentsSize property

Gets or sets maximum size of all attachments together in bytes.

Syntax

public long MaxTotalAttachmentsSize { get; set; }

Property Value

Type:                    System.Int64

Default value:   0

Value of 0 means the maximum size is unlimited.

 

Title property

Gets or sets a title text of the control.

Syntax

public string Title { get; set; }

Property Value

Type:                    System.TextWrapping

Default value:   “Attachments”

The text of the title of an Attachments control.

 

TitleTextWrapping property

Gets or sets a flag indicating whether to wrap title text.

Syntax

public TextWrapping TitleTextWrapping { get; set; }

Property Value

Type:                    System.TextWrapping

Default value:   TextWrapping.NoWrap

Determines wrapping of the control’s title text.

 

TotalFileSizeExceededMessage property

Gets or sets an error message when total file size of all attachments exceeds size limit.

Syntax

public string TotalFileSizeExceededMessage { get; set; }

Property Value

Type:                    System.String

Default value:   “Attachments size exceeded. Total allowed size: {0} bytes”

The message is formatted before showing; the parameter {0} is replaced with the current value of property MaxTotalAttachmentsSize.