Attachment object

An Attachment object represents a single a file or Internet address attached to a field object and is opened directly.

You get an Attachment object from the Attachments property of an entity object, such as Bug object and Req object.

Public methods

This object supports the following methods.

Method Description

 Post

Posts all changed values into database.

Syntax: Post()

Call Post after creating or changing an object and before the object is released. Objects are released in many ways, for example: by going out of scope, by ending the connection, or by being explicitly released in your code.

 Refresh

Reads saved values, overwriting values in memory.

Syntax: Refresh()

 Rename

Renames the attachment on the server. The attachment must be uploaded before calling this method.

Syntax: Rename(newName)

Parameter:

  • newName. A string that represents the new name of the attachment.

 Undo

Undoes changes to field values that have not been posted.

Syntax: Undo()

Public properties

This object supports the following properties.

Property R/W Type Description

AutoPost

R/W Boolean

If true, the database is updated immediately when the field value changes.

Syntax: Attachment.AutoPost

Description

R/W String

The attachment description.

Syntax: Attachment.Description

Field

R/W String

The value of the specified field.

Syntax: Attachment.Field[fieldName]

Parameters:

  • fieldName. A string that represents the name of the field in the project database. Use all upper case.

FieldMultiValue

R/W Object

The MultiValue object of the specified field. See MultiValue object.

Syntax: Attachment.FieldMultiValue[fieldName]

Parameters:

  • fieldName. A string that represents the name of the field in the project database. Use all upper case.

FileSize

R Number

The attachment file size in bytes.

Syntax: Attachment.FileSize()

ID

R Number

The item ID.

Syntax: Attachment.ID

LastModified

R Date

The last modified time.

Syntax: Attachment.LastModified

Modified

R Boolean

Checks if the item has been modified since last refresh or post operation. If true, the field properties on the server side are not up to date.

Syntax: Attachment.Modified()

Name

R String

The attachment name.

Syntax: Attachment.Name

Return: The name of the file that was attached. For example, SampleAttachment.txt.

Type

R/W String

The attachment type. Either File or URL.

Syntax: Attachmen.Type

TypeName

R String

The field's type.

Syntax: Attachment.TypeName

Virtual

R Boolean

Checks if this is a virtual item, that is, an item that does not have a corresponding database record.

Back to top