Click or drag to resize

ConneXionInsertAttachment Method

Inserts the attachment.

Namespace:  ConneXion
Assembly:  ConneXion (in ConneXion.dll) Version: 2020.0
Syntax
public ConneXionResult InsertAttachment(
	ref Attachment oAttachment
)

Parameters

oAttachment
Type: ConneXionAttachment
The attachment data object to Insert.

Return Value

Type: ConneXionResult
ConneXionResult.
Remarks

Required Fields

  • TAMUserName
  • TAMPassword
  • TAMCentralAgency - only if agency is on AppliedOnline
  • LicenseKey - only if agency is an Agency of Vendor
  • FileName
Tip Tip

It is advised to provide more fields to increase performance while Insert. For Example:

  • EntityID
  • FileInfo
  • Category
  • Description
Examples
VB
Dim oConneXion As New ConneXion.ConneXion
Dim oAttachment As New ConneXion.Attachment
Dim oResult As ConneXion.ConneXionResult
Dim oFileInfo() As ConneXion.Attachment.FileInfoClass
Dim oFile As System.IO.FileStream
Dim binaryData() As Byte
Dim lFileSize As Long

oAttachment.TAMUserName = "EXEC"
oAttachment.TAMPassword = "PSWD"

ReDim oFileInfo(0)
oFileInfo(0) = New ConneXion.Attachment.FileInfoClass
oFileInfo(0).Category = "IMAGE"
oFileInfo(0).Description = "Car Image"
oFileInfo(0).FileName = "CarVBN809.jpg"

oFile = New System.IO.FileStream("C:\CarVBN809.jpg", IO.FileMode.Open, IO.FileAccess.Read)
lFileSize = FileLen("C:\CarVBN809.jpg")
ReDim binaryData(lFileSize - 1)
oFile.Read(binaryData, 0, lFileSize)
oFile.Close()
oFileInfo(0).Data = System.Convert.ToBase64String(binaryData)
oAttachment.FileInfo = oFileInfo

oAttachment.EntityKey = "C"
oAttachment.EntityID = "ABBOJO1"
oAttachment.UserDate = "20030909"
oAttachment.AttachedBy = "EX"
oResult = oConneXion.InsertAttachment(oAttachment)

If oResult.Success Then
    MessageBox.Show("Insert Attachment is successful")
    txtResult.Text = oResult.Description & vbCrLf & "Record Number: " & oAttachment.RecordNumber
Else
    txtResult.Text = "Insert Attachment is false" & vbCrLf & "Number: " & oResult.Number & vbCrLf & "Desc: " &
     oResult.Description & vbCrLf & "TAMErrorNumber: " & oResult.TAMErrorNumber & vbCrLf & "TAMErroDesc: " & oResult.TAMDescription
End If
See Also