Skip to content

Document Management

Verified against source (5)

  • attachment/Attachment.cs
  • application/GenericObject.cs
  • Attachment/Attachment.ashx.cs
  • Extensions/AttachmentExtensions.cs
  • Extensions/AttachmentExtensions.cs

Documents are Attachment records. Operations follow the standard QBO route pattern:

  • /api/attachment/{operation} runs synchronously on the web server.
  • /api/attachment/queue/{operation} queues the operation (for example on SQS) for an app server. Use it for long-running work such as bulk generation or large transfers.
Type Purpose
Attachment A single document, bound to a parent through Object / ObjectID.
AttachmentTemplate Behavior for a kind of document: Method (data), AttachmentService (generator), FileObjectAssembly (storage).
IGenerator Renders a document from data (mail merge, delimited, Parquet, and so on).
IFileObject Reads, writes, lists, and deletes files in a storage location.
IDelivery Prepares and tracks delivery of mailed documents.
GET /api/attachment/generate?Template=Welcome Letter&Object=Contact&ObjectID=1

Pass the template by name (Template) or ID (TemplateID), plus the parent Object and ObjectID. QBO fetches the template’s data, runs its generator, and saves the result as an attachment on the record.

For large batches, queue it:

GET /api/attachment/queue/generate?Template=Welcome Letter&Object=Contact&ObjectID=1

Upload in chunks of up to 500 KB. Small files fit in a single chunk:

POST /api/attachment/uploadchunk?Object=Organization&ObjectID=1&X-File-Name=Test.pdf&X-File-Size={size}
{raw file bytes}

The response includes finish and upload_name. If finish is false, send the next chunk with X-File-GUID={upload_name}, and repeat until finish is true.

GET /api/attachment/download?ID=7
GET /api/attachment/view?ID=7

download tells the browser to save the file; view sends its MIME type so the browser can display it.

Operation Copies the file Repoints the attachment Deletes the original
copyfile Yes No No
transferfile Yes Yes No
movefile Yes Yes Yes
GET /api/attachment/copyfile?ID=1988,1989&FileObject=SAN&PathURL=/{Object}/{ObjectID}/{Guid}.{Uri.Extension}
GET /api/attachment/watch?FileObject=ClientAOut&Path=/ToQBO/&TransferTo=AmazonS3&Object=Loan

PathURL supports substitutions such as {Guid}, {Year}, {Month}, {Uri.FileName}, {Uri.Extension}, and any Attachment column.

Operation What it does
ocrtodescription Extracts text into Attachment.Description for searching
convert / convertsave Converts a document (for example to PDF)
unzip Extracts a zip into one attachment per file
aiclassify AI chooses the attachment template, running OCR first if needed
aitranscribe AI transcribes an audio file (mp3) to text
getduplicates Finds attachments with an identical file hash
savefilehash Calculates and stores a file hash (optional Algorithm, e.g. SHA1)
GET /api/attachment/getduplicates?ID=6&CompareID=13,27,28
GET /api/attachment/savefilehash?ID=6&Algorithm=SHA1