GetDocument

Description

Fetches the ECM document including all metadata and files from the repository and stores it in a temporary document buffer table.


Syntax

AL
[ErrorCode:= ] GetDocument(ECMServerCode: Code[20]; ECMRepositoryID: Text; ECMRepositoryRef: Text; ECMDocRef: Text; DocumentID: Text; FileName: Text; var TmpECMDocBuffer: Record "ECM Document Buffer")
 
[ErrorCode:= ] GetDocument(ECMServerCode: Code[20]; ECMRepositoryID: Text; ECMRepositoryRef: Text; ECMDocRef: Text; DocumentID: Text; FileName: Text; FileHandling: Enum "ECM FileHandling"; OpenDocumentsVia: Enum "ECM open Documents via"; DocumentView: Enum "ECM Document View"; var TmpECMDocBuffer: Record "ECM Document Buffer")


Parameters

ECMServerCode

Type: Code

Contains the ECM server code.


ECMRepositoryID

Type: Text

Contains the ECM repository ID. This variable can be passed empty.


ECMRepositoryRef

Type: Text

Contains the ECM repository reference. This variable can be passed empty.


ECMDocRef

Type: Text

Contains the ECM docuemnt reference (reference to the repository. This variable can be passed empty.


DocumentID

Type: Text

Contains the document ID. This variable can be passed empty.


FileName

Type: Text

Contains the file name under which the file is stored locally (download). If "empty", the file name from the repository is used.


[Optional] FileHandling

Type: Enum "ECM FileHandling"

Defines what happens to the file that is downloaded from the repository.

  • [1] Open

  • [2] Print

  • [3] EMail

  • [4] "Internal EMail"

  • [5] Save


[Optional] OpenDocumentsVia

Type: Enum "ECM open Documents via"

Defines how the downloaded document should be opened:

Corresponds to the field "Open documents by" of the ECM User card


[Optional] DocumentView

Type: Enum "ECM Document View"

Defines how the downloaded document should be opened:

Corresponds to the field "document view" of the ECM User card



Variable: TmpECMDocBuffer

Type: Record "ECM Document Buffer" temporary

Data container for the metadata from the repository.


Return Value:

ErrorCode

Type: Integer

ErrorCode = 0 if the operation was successful.



Remarks:

With this function, metadata and files can be downloaded from the repository and processed further.

E.g. to send invoices as e-mail.

If the fields "ECMServerCode", "ECMRepositoryID", "ECMRepositoryRef" are not known, one can look in the corresponding document items.


Example: